benchmark.ts
v1.0.1
Published
Measure the time to execute the given function.
Downloads
4
Maintainers
Readme
benchmark.ts
Measure the time to execute the given function.
Similar to jsperf.com but doesn't need to be hosted.
Remark
For async functions (e.g. with disk/network I/O), use estimateAsync()
.
For sync functions, e.g. (CPU intensive calculations), use estimateSync()
Example
The cost of OOP: source
| Approach | Time to iterate 1m times | ops/second | | :------: | ---------: | ------ | | FP | 662.61 ms | 1510 k | | OOP | 5604.00 ms | 180 k |
More examples: