1.0.1 • Published 4 years ago

benchmark.ts v1.0.1

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
4 years ago

benchmark.ts

Measure the time to execute the given function.

npm Package Version

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

ApproachTime to iterate 1m timesops/second
FP662.61 ms1510 k
OOP5604.00 ms180 k

More examples:

License

BSD 2-Clause License