https://github.com/originjs/js-test-benchmark
js test benchmark
https://github.com/originjs/js-test-benchmark
Last synced: 11 months ago
JSON representation
js test benchmark
- Host: GitHub
- URL: https://github.com/originjs/js-test-benchmark
- Owner: originjs
- License: mulanpsl-2.0
- Created: 2024-01-25T09:55:36.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T06:33:30.000Z (almost 2 years ago)
- Last Synced: 2025-04-05T03:41:22.101Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 786 KB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## js-test-benchmark
### Usage
Generate test cases
```bash
node ./testCaseFactory/createCase.js fileCount caseCountInFile cpuSpendMillisecond ioSpendMillisecond
# Generate fileCount test files (fileCount must be a multiple of 10), and generate caseCountInFile test cases in each file (caseCountInFile must be a multiple of 5).
# The total number of test cases (fileCount * caseCountInFile) must be less than 100000.
# Time spent of cpu simulating business functions (ms).
# Time spent of io simulating business functions (ms).
#Example:node ./testCaseFactory/createCase.js 100 10 500 500
```
Run benchmark
```bash
pnpm install
pnpm run test:ben
```
### Output
About [result](https://github.com/sharkdp/hyperfine/issues/443#issuecomment-964856075)
| Command | Mean [s] | Min [s] | Max [s] | Relative |
|:---|---:|---:|---:|---:|
| `pnpm run test:jest` | 5.046 ± 0.579 | 4.685 | 5.713 | 1.47 ± 0.23 |
| `pnpm run test:vitest` | 3.434 ± 0.356 | 3.124 | 3.823 | 1.00 |
| `pnpm run test:jest:inline` | 5.589 ± 0.278 | 5.283 | 5.826 | 1.63 ± 0.19 |
| `pnpm run test:vitest:inline` | 3.521 ± 0.418 | 3.234 | 4.001 | 1.03 ± 0.16 |