https://github.com/kkristof200/js_funcmeasure
measure&compare execution times
https://github.com/kkristof200/js_funcmeasure
Last synced: 3 months ago
JSON representation
measure&compare execution times
- Host: GitHub
- URL: https://github.com/kkristof200/js_funcmeasure
- Owner: kkristof200
- Created: 2020-08-25T20:57:55.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-26T10:24:08.000Z (almost 5 years ago)
- Last Synced: 2025-03-30T16:02:18.854Z (4 months ago)
- Language: TypeScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Installation
```
npm install --save funcmeasure
```## Usage
```typescript
import { measure } from 'funcmeasure';function f1() { 1 + 1 }
function f2() {
var i = 5for (let _ = 0; _ < 100; _ ++) {
i = Math.pow(i, 10)
}
}let measurements = measure([f1, f2], 10000, true)
```## Result
```
Tested 2 functions, ran 10000 times each.--------------------------------------------------------------
| Function | Total Duration | Avg Duration | Score |
--------------------------------------------------------------
| f1 | 0.000309193 | 3.09e-8 | fastest |
| f2 | 0.008580814 | 8.581e-7 | 27.75x slower |
--------------------------------------------------------------
```