Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ Legend-state seeks to be the fastest React state management library. Achieving
- Micro-optimizations: Optimizations related to JavaScript primitives (iteration, Object types, etc.)
- Array Optimizations: Optimizations related to the efficient rendering of large lists of data.

## Running Benchmarks

We use [hyperfine](https://github.com/sharkdp/hyperfine) for running benchmarks. You will need this installed in order to run the benchmark script.
## Benchmark Dependencies

We use [hyperfine](https://github.com/sharkdp/hyperfine) for running benchmarks.

## Running Benchmarks

All benchmarked optimizations will have a directory within the relevant optimization category directory (i.e. `architecture-optimizations`, `micro-optimizations`, `array-optimizations`). Each optimization directory will have a list of JavaScript files that each implement an approach and then a `bench.sh` that uses `hyperfine` to run the benchmark.

Expand Down
5 changes: 5 additions & 0 deletions benchmarks/baseline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Establishing a baseline

When benchmarking Javascript with different engines the startup time of the engine needs to be considered. Some engines, such as Hermes, are optimized for very quick startup time. To ensure that we are performing an apples to applies comparison of engine performance, and not startup, we start by establishing a baseline of how long each engine takes to startup. We then adjust each benchmark by this startup time.

To measure the startup time we have each engine run on a empty `.js` file. The startup benchmarks are stored in `$ENGINEBaseline.json`.
3 changes: 3 additions & 0 deletions benchmarks/baseline/bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hyperfine --warmup 3 --runs 1000 --export-json hermesBaseline.json "hermes empty.js"

hyperfine --warmup 3 --runs 1000 --export-json nodeBaseline.json "node empty.js"
Empty file added benchmarks/baseline/empty.js
Empty file.
Loading