All Projects → JoshuaWise → nodemark

JoshuaWise / nodemark

Licence: MIT license
A modern benchmarking library for Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nodemark

compbench
⌛ Benchmark and visualization of various compression algorithms
Stars: ✭ 21 (-8.7%)
Mutual labels:  benchmark
playwright-test
Run unit tests with several runners or benchmark inside real browsers with playwright.
Stars: ✭ 81 (+252.17%)
Mutual labels:  benchmark
rust-web-benchmarks
Benchmarking web frameworks written in rust with rewrk tool.
Stars: ✭ 97 (+321.74%)
Mutual labels:  benchmark
QASMBench
QASMBench is an OpenQASM benchmark suite running on IBM Quantum-Experience backends.
Stars: ✭ 22 (-4.35%)
Mutual labels:  benchmark
streamalg
Extensible stream pipelines with object algebras.
Stars: ✭ 26 (+13.04%)
Mutual labels:  benchmark
perforator
Record "perf" performance metrics for individual functions/regions of an ELF binary.
Stars: ✭ 33 (+43.48%)
Mutual labels:  benchmark
utils
⚡ A collection of common functions but with better performance, less allocations and less dependencies created for Fiber.
Stars: ✭ 21 (-8.7%)
Mutual labels:  benchmark
gobench
A benchmark framework based on Golang
Stars: ✭ 50 (+117.39%)
Mutual labels:  benchmark
php-orm-benchmark
The benchmark to compare performance of PHP ORM solutions.
Stars: ✭ 82 (+256.52%)
Mutual labels:  benchmark
Shuhai
Shuhai is a benchmarking-memory tool that allows FPGA programmers to demystify all the underlying details of memories, e.g., HBM and DDR4, on a Xilinx FPGA
Stars: ✭ 53 (+130.43%)
Mutual labels:  benchmark
scRNAseq cell cluster labeling
Scripts to run and benchmark scRNA-seq cell cluster labeling methods
Stars: ✭ 41 (+78.26%)
Mutual labels:  benchmark
DiscEval
Discourse Based Evaluation of Language Understanding
Stars: ✭ 18 (-21.74%)
Mutual labels:  benchmark
react-native-startup-time
measure startup time of your react-native app
Stars: ✭ 88 (+282.61%)
Mutual labels:  benchmark
moros
A modern http(s) benchmark tool
Stars: ✭ 14 (-39.13%)
Mutual labels:  benchmark
micro-runner
Micro-Runner, a CLI playground for benchmarking your JavaScript code
Stars: ✭ 27 (+17.39%)
Mutual labels:  benchmark
dnstrace
Command-line DNS benchmark
Stars: ✭ 68 (+195.65%)
Mutual labels:  benchmark
DeepLearningBenchmarks
Benchmarks across Deep Learning Frameworks in Julia and Python
Stars: ✭ 24 (+4.35%)
Mutual labels:  benchmark
word-benchmarks
Benchmarks for intrinsic word embeddings evaluation.
Stars: ✭ 45 (+95.65%)
Mutual labels:  benchmark
OptimisationAlgorithms
Searching global optima with firefly algorithm and solving traveling salesmen problem with genetic algorithm
Stars: ✭ 20 (-13.04%)
Mutual labels:  benchmark
php-framework-benchmark
php framework benchmark (include laravel、symfony、silex、lumen、slim、yii2、tastphp etc)
Stars: ✭ 17 (-26.09%)
Mutual labels:  benchmark

nodemark Build Status

A modern benchmarking library for Node.js, capable of generating statistically significant results.

Installation

npm install --save-dev nodemark

Usage

const benchmark = require('nodemark');

const result = benchmark(myFunction, setupFunction);
console.log(result); // => 14,114,886 ops/sec ±0.58% (7906233 samples)
console.log(result.nanoseconds()); // => 71

Statistical Significance

In benchmarking, it's important to generate statistically significant results. Thankfully, nodemark makes this easy:

  • The margin of error is calculated for you.
  • The noise caused by nodemark is factored out of the results.
  • The garbage collector is manipulated to prevent early runs from having an unfair advantage.
  • Executions done before v8 has a chance to optimize things (JIT) are ignored.

The combination of these things makes it a highly accurate measuring device. However, any benchmark done in JavaScript has its limits. If the average time measured by a benchmark is too small to be reliable (< 10ns), the results will be NaN in order to avoid providing misleading information.

API

benchmark(subject, [setup, [duration]]) -> benchmarkResult

Runs a new benchmark. This measures the performance of the subject function. If a setup function is provided, it will be invoked before every execution of subject.

By default, the benchmark runs for about 3 seconds, but this can be overridden by passing a duration number (in milliseconds). Regardless of the desired duration, the benchmark will not finish until the subject has been run at least 10 times.

Both subject and setup can run asynchronously by declaring a callback argument in their signature. If you do this, you must invoke the callback to indicate that the operation is complete. When running an asyncronous benchmark, this function returns a promise. However, because subject and setup use callbacks rather than promises, synchronous errors will not automatically be caught.

benchmark(callback => fs.readFile('foo.txt', callback))
  .then(console.log);

There is no plan to support promises in subject and setup because it would cause too much overhead and yield inaccurate results.

class BenchmarkResult

Each benchmark returns an immutable object describing the result of that benchmark. It has five properties:

  • mean, the average measured time in nanoseconds
  • error, the margin of error as a ratio of the mean
  • max, the fastest measured time in nanoseconds
  • min, the slowest measured time in nanoseconds
  • count, the number of times the subject was invoked and measured

.nanoseconds([precision]) -> number

Returns this.mean, rounded to the nearest whole number or the number of decimal places specified by precision.

.microseconds([precision]) -> number

Same as .nanoseconds(), but the value is in microseconds.

.milliseconds([precision]) -> number

Same as .nanoseconds(), but the value is in milliseconds.

.seconds([precision]) -> number

Same as .nanoseconds(), but the value is in seconds.

.hz([precision]) -> number

Returns the average number of executions per second, rounded to the nearest whole number or the number of decimal places specified by precision.

.sd([precision]) -> number

Returns the standard deviation in nanoseconds, rounded to the nearest whole number or the number of decimal places specified by precision.

.toString([format]) -> number

Returns a nicely formatted string describing the result of the benchmark. By default, the "hz" format is used, which displays ops/sec, but you can optionally specify "nanoseconds", "microseconds", "milliseconds", or "seconds" to change the displayed information.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].