overtake 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +32 -0
  2. package/cli.js +6 -11
  3. package/index.js +1 -1
  4. package/package.json +9 -10
package/README.md CHANGED
@@ -38,6 +38,8 @@ $ npm install -D overtake
38
38
 
39
39
  ## Examples
40
40
 
41
+ ### Public interface
42
+
41
43
  Create a benchmark in `__benchmarks__` folder
42
44
 
43
45
  ```javascript
@@ -91,6 +93,36 @@ or
91
93
  npx overtake
92
94
  ```
93
95
 
96
+ ### Inline support
97
+
98
+ ```bash
99
+ npx overtake -i "class A{}" -i "function A() {}" -i "A = () => {};" -c 20000
100
+ ```
101
+
102
+ ```
103
+ ⭐ Script
104
+ ⇶ Suite
105
+ ➤ Perform
106
+ ✓ Measure class A{}
107
+ ┌─────────┬──────────┬──────────┬──────────┬───────────┬───────┐
108
+ │ (index) │ med │ p95 │ p99 │ total │ count │
109
+ ├─────────┼──────────┼──────────┼──────────┼───────────┼───────┤
110
+ │ 0.0005 │ 0.000551 │ 0.001493 │ 0.002344 │ 16.506385 │ 20000 │
111
+ └─────────┴──────────┴──────────┴──────────┴───────────┴───────┘
112
+ ✓ Measure function A() {}
113
+ ┌─────────┬─────────┬────────┬──────────┬──────────┬───────┐
114
+ │ (index) │ med │ p95 │ p99 │ total │ count │
115
+ ├─────────┼─────────┼────────┼──────────┼──────────┼───────┤
116
+ │ 0.00008 │ 0.00009 │ 0.0003 │ 0.000441 │ 2.875578 │ 20000 │
117
+ └─────────┴─────────┴────────┴──────────┴──────────┴───────┘
118
+ ✓ Measure A = () => {};
119
+ ┌─────────┬─────────┬──────────┬──────────┬─────────┬───────┐
120
+ │ (index) │ med │ p95 │ p99 │ total │ count │
121
+ ├─────────┼─────────┼──────────┼──────────┼─────────┼───────┤
122
+ │ 0.00008 │ 0.00012 │ 0.000331 │ 0.000601 │ 3.42556 │ 20000 │
123
+ └─────────┴─────────┴──────────┴──────────┴─────────┴───────┘
124
+ ```
125
+
94
126
  Please take a look at [benchmarks](__benchmarks__) to see more examples
95
127
 
96
128
  ## License
package/cli.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
 
3
3
  import { Command } from 'commander';
4
- import { promisify } from 'util';
5
4
  import Path from 'path';
6
5
  import glob from 'glob';
7
6
  import { load, createScript, benchmark, setup, teardown, measure, perform, run, defaultReporter } from './index.js';
@@ -18,16 +17,12 @@ commands
18
17
  .action(async (patterns, { count = 1, inline }) => {
19
18
  Object.assign(globalThis, { benchmark, setup, teardown, measure, perform });
20
19
 
21
- const globAsync = promisify(glob);
22
- const foundFiles = await Promise.all(patterns.map((pattern) => globAsync(pattern)));
23
- const files = [
24
- ...new Set(
25
- []
26
- .concat(...foundFiles)
27
- .map((filename) => Path.resolve(filename))
28
- .filter(Boolean)
29
- ),
30
- ];
20
+ const foundFiles = await glob(patterns);
21
+ if (!foundFiles.length) {
22
+ console.error(`No files found with patterns ${patterns.join(', ')}`);
23
+ process.exit(1);
24
+ }
25
+ const files = [...new Set(foundFiles.map((filename) => Path.resolve(filename)).filter(Boolean))];
31
26
 
32
27
  const scripts = [];
33
28
  if (inline.length) {
package/index.js CHANGED
@@ -97,7 +97,7 @@ export const run = async (scripts, reporter) => {
97
97
  for (const perform of suite.performs) {
98
98
  await suiteTest.test('perform', perform.title, async (performTest) => {
99
99
  for (const measure of suite.measures) {
100
- await performTest.test('measure', measure.title, async (measureTest) => {
100
+ await performTest.test('measure', perform.count + ' ' + measure.title, async (measureTest) => {
101
101
  const result = await runWorker({
102
102
  setup: suite.setup,
103
103
  teardown: suite.teardown,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overtake",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "NodeJS performance benchmark",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -11,7 +11,6 @@
11
11
  "scripts": {
12
12
  "start": "./cli.js",
13
13
  "test": "yarn node --experimental-vm-modules $(yarn bin jest) --detectOpenHandles",
14
- "lint": "eslint .",
15
14
  "prepare": "husky install"
16
15
  },
17
16
  "repository": {
@@ -31,16 +30,16 @@
31
30
  },
32
31
  "homepage": "https://github.com/3axap4eHko/overtake#readme",
33
32
  "devDependencies": {
34
- "@jest/globals": "^27.5.1",
35
- "@types/jest": "^27.4.1",
36
- "husky": "^7.0.4",
37
- "jest": "^27.5.1",
38
- "prettier": "^2.6.2",
33
+ "@jest/globals": "^29.5.0",
34
+ "@types/jest": "^29.5.0",
35
+ "husky": "^8.0.3",
36
+ "jest": "^29.5.0",
37
+ "prettier": "^2.8.4",
39
38
  "pretty-quick": "^3.1.3"
40
39
  },
41
40
  "dependencies": {
42
- "commander": "^9.2.0",
43
- "conode": "^0.1.0",
44
- "glob": "^8.0.1"
41
+ "commander": "^10.0.0",
42
+ "conode": "^0.1.23",
43
+ "glob": "^9.3.0"
45
44
  }
46
45
  }