Skip to content

beenotung/benchmark.ts

Repository files navigation

benchmark.ts

Measure the time needed to execute a 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

Approach Time to iterate 1m times ops/second
FP 662.61 ms 1510 k
OOP 5604.00 ms 180 k

More examples:

License

BSD 2-Clause License

About

Measure the time needed to execute a given function.

Resources

License

Stars

Watchers

Forks

Packages

No packages published