Name Date Size

..25-Oct-20244 KiB

_benchmark_progress.jsH A D25-Oct-20243.9 KiB

_cli.jsH A D25-Oct-20243.1 KiB

_cli.RH A D25-Oct-2024494

_http-benchmarkers.jsH A D25-Oct-20247.4 KiB

_test-double-benchmarker.jsH A D25-Oct-20241.1 KiB

assert/H25-Oct-20244 KiB

async_hooks/H25-Oct-20244 KiB

bar.RH A D25-Oct-20241.1 KiB

blob/H25-Oct-20244 KiB

buffers/H25-Oct-20244 KiB

child_process/H25-Oct-20244 KiB

cluster/H25-Oct-20244 KiB

common.jsH A D25-Oct-202413.1 KiB

compare.jsH A D25-Oct-20243.5 KiB

compare.RH A D25-Oct-20243.9 KiB

crypto/H25-Oct-20244 KiB

dgram/H25-Oct-20244 KiB

diagnostics_channel/H25-Oct-20244 KiB

dns/H25-Oct-20244 KiB

domain/H25-Oct-20244 KiB

error/H25-Oct-20244 KiB

es/H25-Oct-20244 KiB

esm/H25-Oct-20244 KiB

events/H25-Oct-20244 KiB

fixtures/H25-Oct-20244 KiB

fs/H25-Oct-20244 KiB

http/H25-Oct-20244 KiB

http2/H25-Oct-20244 KiB

https/H25-Oct-20244 KiB

misc/H25-Oct-20244 KiB

module/H25-Oct-20244 KiB

napi/H25-Oct-20244 KiB

net/H25-Oct-20244 KiB

os/H25-Oct-20244 KiB

path/H25-Oct-20244 KiB

perf_hooks/H25-Oct-20244 KiB

policy/H25-Oct-20244 KiB

process/H25-Oct-20244 KiB

querystring/H25-Oct-20244 KiB

README.mdH A D25-Oct-20243.2 KiB

run.jsH A D25-Oct-20242.5 KiB

scatter.jsH A D25-Oct-20241.8 KiB

scatter.RH A D25-Oct-20242.4 KiB

streams/H25-Oct-20244 KiB

string_decoder/H25-Oct-20244 KiB

test_runner/H25-Oct-20244 KiB

timers/H25-Oct-20244 KiB

tls/H25-Oct-20244 KiB

url/H25-Oct-20244 KiB

util/H25-Oct-20244 KiB

v8/H25-Oct-20244 KiB

vm/H25-Oct-20244 KiB

webstreams/H25-Oct-20244 KiB

worker/H25-Oct-20244 KiB

zlib/H25-Oct-20244 KiB

README.md

1# Node.js Core Benchmarks
2
3This folder contains code and data used to measure performance
4of different Node.js implementations and different ways of
5writing JavaScript run by the built-in JavaScript engine.
6
7For a detailed guide on how to write and run benchmarks in this
8directory, see [the guide on benchmarks](../doc/contributing/writing-and-running-benchmarks.md).
9
10## Table of Contents
11
12* [File tree structure](#file-tree-structure)
13* [Common API](#common-api)
14
15## File tree structure
16
17### Directories
18
19Benchmarks testing the performance of a single node submodule are placed into a
20directory with the corresponding name, so that they can be executed by submodule
21or individually.
22Benchmarks that span multiple submodules may either be placed into the `misc`
23directory or into a directory named after the feature they benchmark.
24E.g. benchmarks for various new ECMAScript features and their pre-ES2015
25counterparts are placed in a directory named `es`.
26Fixtures that are not specific to a certain benchmark but can be reused
27throughout the benchmark suite should be placed in the `fixtures` directory.
28
29### Other Top-level files
30
31The top-level files include common dependencies of the benchmarks
32and the tools for launching benchmarks and visualizing their output.
33The actual benchmark scripts should be placed in their corresponding
34directories.
35
36* `_benchmark_progress.js`: implements the progress bar displayed
37  when running `compare.js`
38* `_cli.js`: parses the command line arguments passed to `compare.js`,
39  `run.js` and `scatter.js`
40* `_cli.R`: parses the command line arguments passed to `compare.R`
41* `_http-benchmarkers.js`: selects and runs external tools for benchmarking
42  the `http` subsystem.
43* `common.js`: see [Common API](#common-api).
44* `compare.js`: command line tool for comparing performance between different
45  Node.js binaries.
46* `compare.R`: R script for statistically analyzing the output of
47  `compare.js`
48* `run.js`: command line tool for running individual benchmark suite(s).
49* `scatter.js`: command line tool for comparing the performance
50  between different parameters in benchmark configurations,
51  for example to analyze the time complexity.
52* `scatter.R`: R script for visualizing the output of `scatter.js` with
53  scatter plots.
54
55## Common API
56
57The common.js module is used by benchmarks for consistency across repeated
58tasks. It has a number of helpful functions and properties to help with
59writing benchmarks.
60
61### `createBenchmark(fn, configs[, options])`
62
63See [the guide on writing benchmarks](../doc/contributing/writing-and-running-benchmarks.md#basics-of-a-benchmark).
64
65### `default_http_benchmarker`
66
67The default benchmarker used to run HTTP benchmarks.
68See [the guide on writing HTTP benchmarks](../doc/contributing/writing-and-running-benchmarks.md#creating-an-http-benchmark).
69
70### `PORT`
71
72The default port used to run HTTP benchmarks.
73See [the guide on writing HTTP benchmarks](../doc/contributing/writing-and-running-benchmarks.md#creating-an-http-benchmark).
74
75### `sendResult(data)`
76
77Used in special benchmarks that can't use `createBenchmark` and the object
78it returns to accomplish what they need. This function reports timing
79data to the parent process (usually created by running `compare.js`, `run.js` or
80`scatter.js`).
81