benchmark.ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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

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

Package Sidebar

Install

npm i benchmark.ts

Weekly Downloads

1

Version

1.0.1

License

BSD-2-Clause

Unpacked Size

8.61 kB

Total Files

11

Last publish

Collaborators

  • beenotung