Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/limit-bench
Benchmarks a file with time limits
https://github.com/mikolalysenko/limit-bench
Last synced: 7 days ago
JSON representation
Benchmarks a file with time limits
- Host: GitHub
- URL: https://github.com/mikolalysenko/limit-bench
- Owner: mikolalysenko
- License: mit
- Created: 2013-04-20T04:32:57.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-14T00:12:38.000Z (over 11 years ago)
- Last Synced: 2024-12-16T22:35:07.200Z (10 days ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
limit-bench
===========
Runs a benchmark with a time limit.## Example
```javascript
var counter = 0
console.log(require("limit-bench")(
1000, //Run for 1000 ms
100, //Do 100 warm up iterations
function() {
++counter //Just increment a counter
}
))
```## Install
npm install limit-bench
### `require("limit-bench")(time_limit, warmup, task)`
Benchmarks task by running it for about `time_limit` milliseconds.* `time_limit`: The number of milliseconds to run task for (rounds up to nearest task count)
* `warmup`: The number of warm up iterations to run the task
* `task`: A function to benchmark**Returns** The average time per task in milliseconds
### Why use this benchmark tool instead of one of the million others?
Because it lets you put time limits on the tasks. This means that you can avoid spinning forever if you are comparing a slow implementation to some relatively much faster implementation.
# Credits
(c) 2013 Mikola Lysenko. MIT License