{"id":32538885,"url":"https://github.com/level/bench","last_synced_at":"2025-10-28T14:56:48.139Z","repository":{"id":34905323,"uuid":"188557559","full_name":"Level/bench","owner":"Level","description":"Benchmark abstract-level databases.","archived":false,"fork":false,"pushed_at":"2023-03-01T09:57:58.000Z","size":361,"stargazers_count":8,"open_issues_count":6,"forks_count":2,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-18T23:44:40.389Z","etag":null,"topics":["abstract-level","benchmark","gnuplot","level","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Level.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"level"}},"created_at":"2019-05-25T11:24:23.000Z","updated_at":"2024-03-25T05:08:16.000Z","dependencies_parsed_at":"2023-09-26T01:42:46.835Z","dependency_job_id":null,"html_url":"https://github.com/Level/bench","commit_stats":{"total_commits":70,"total_committers":4,"mean_commits":17.5,"dds":"0.17142857142857137","last_synced_commit":"ad235fd710dda8dec3a172ff10f923fc2a0b8a89"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Level/bench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fbench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fbench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fbench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fbench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Level","download_url":"https://codeload.github.com/Level/bench/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Level%2Fbench/sbom","scorecard":{"id":83767,"data":{"date":"2025-08-11","repo":{"name":"github.com/Level/bench","commit":"ad235fd710dda8dec3a172ff10f923fc2a0b8a89"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: topLevel 'contents' permission set to 'write': .github/workflows/release.yml:6","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/Level/bench/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/Level/bench/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/Level/bench/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/Level/bench/test.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:19","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 15 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T06:28:49.524Z","repository_id":34905323,"created_at":"2025-08-15T06:28:49.524Z","updated_at":"2025-08-15T06:28:49.524Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281457723,"owners_count":26504808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract-level","benchmark","gnuplot","level","nodejs"],"created_at":"2025-10-28T14:56:46.572Z","updated_at":"2025-10-28T14:56:48.132Z","avatar_url":"https://github.com/Level.png","language":"JavaScript","readme":"# level-bench\n\n**Benchmark [`abstract-level`](https://github.com/Level/abstract-level) databases.** Currently only suitable for use in Node.js.\n\n[![level badge][level-badge]](https://github.com/Level/awesome)\n[![npm](https://img.shields.io/npm/v/level-bench.svg)](https://www.npmjs.com/package/level-bench)\n[![Node version](https://img.shields.io/node/v/level-bench.svg)](https://www.npmjs.com/package/level-bench)\n[![Test](https://img.shields.io/github/workflow/status/Level/bench/Test?label=test)](https://github.com/Level/bench/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Level/bench?label=\u0026logo=codecov\u0026logoColor=fff)](https://codecov.io/gh/Level/bench)\n[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript\u0026logoColor=fff)](https://standardjs.com)\n[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org)\n[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective\u0026logoColor=fff)](https://opencollective.com/level)\n\n## Example\n\n```\nnpm i level-bench classic-level\nnpx level-bench run batch-put classic-level\nnpx level-bench run batch-put classic-level --b [ --keys seq ]\nnpx level-bench run batch-put classic-level --b [ --keys seqReverse ]\nnpx level-bench plot batch-put\n```\n\nYields the following (showing that writing keys in reverse sequential order is fastest):\n\n![Example plot](example.png)\n\n## Highlights\n\n- Target the current working directory or something npm-installed\n- Compare benchmarks of different targets or options\n- Derives plot labels from benchmark metadata (package, platform, ..)\n- Uses unique temporary directories for every db\n- Also takes `ioredis` and `sqlite3` (see [`third-party/`](./third-party)).\n\n## Usage\n\n### `level-bench run \u003cbenchmark\u003e [target]`\n\nRun a benchmark. The `benchmark` argument must be one of the named benchmarks listed below.\n\nThe `target` argument should be a path or an npm package name that is installed nearby (for example `level-bench run put classic-level`). It defaults to the current working directory. A `package.json` must exist alongside the resolved `target`. If the module doesn't have a default export and it has more than one named export, pass a `--class` or `-c` option to use the named export by that name (for example `level-bench run put classic-level -c ClassicLevel`).\n\nIf `target` does not create persistent databases (like `memory-level`) you must pass `--mem`.\n\nOptions for the db can be provided via `--db \u003csubargs\u003e`. For example `--db [ --cacheSize 16mb ]` or `--db [ --valueEncoding json ]`. Note that the brackets must be surrounded by spaces.\n\nBenchmark-specific options can be provided via `-b \u003csubargs\u003e`. For example `-b [ -n 1e6 --concurrency 1 ]`. These options are listed below.\n\nResults are by default written to `.benchmarks/\u003cbenchmark\u003e.\u003ctime\u003e.csv` and an accompanying JSON file for metadata. To write results to a custom file specify `--out example.csv` (`-o` for short). The metadata is used to derive a distinct benchmark name. When this doesn't suffice (for example because you're benchmarking a spinning disk versus an SSD, a fact that isn't included in the metadata) or when labels in the plot become too long, you can specify a custom name with `--name example`.\n\n#### Examples\n\nWe can compare the performance of two git branches:\n\n```\ngit checkout main \u0026\u0026 npm i\nlevel-bench run put\n\ngit checkout wip \u0026\u0026 npm i\nlevel-bench run put\n```\n\nOr check the overhead of a specific encoding:\n\n```\nlevel-bench run put level --db [ --valueEncoding utf8 ]\nlevel-bench run put level --db [ --valueEncoding json ]\n```\n\nOr compare the effect of options:\n\n```\nlevel-bench run put classic-level\nlevel-bench run put classic-level --db [ --no-compression ]\n```\n\nThen plot both (or more) runs with:\n\n```\nlevel-bench plot put\n```\n\n#### Options\n\nYet to document.\n\n### `level-bench plot \u003cbenchmark\u003e [files]`\n\nPlot the results using `gnuplot` (which must be installed and available in `PATH`). The `files` argument should be ([glob patterns](https://github.com/mrmlnc/fast-glob) resolving to) CSV files as generated by `level-bench run`. If not provided, defaults to `.benchmarks/\u003cbenchmark\u003e.*.csv`.\n\nThe plot is written to `.benchmarks/\u003cbenchmark\u003e.\u003ctime\u003e.png` by default. This can be overridden with `--out \u003cfilename\u003e` (`-o` for short).\n\n#### Options\n\nYet to document.\n\n## Benchmarks\n\n### `put`\n\nPerform concurrent `put()` operations. Records the Simple Moving Average (SMA) of the duration of the last 1000 writes, as well as the Cumulative Moving Average (CMA) of the throughput in MB/s. Options:\n\n- `-n`: amount of operations, default 1e6\n- `--concurrency`: default 4\n- `--keys` (string): one of:\n  - `random` (default): generate pseudo-random numeric keys (0-N) with a certain probability `distribution`\n  - `seq`: non-random, sequential numeric keys (0-N)\n  - `seqReverse`: same keys but in reverse (N-0)\n- `--values` (string): one of:\n  - `random` (default): generate pseudo-random values\n  - `empty`: zero-length values or zero-filled if `valueSize` is set\n- `--seed` (string): seed to use for random numbers, defaults to `'seed'`\n- `--distribution` (string): one of [`zipfian`](https://github.com/vweevers/zipfian-integer), `uniform` (default)\n- `--skew` (floating-point number): Zipfian skew (default 0)\n- `--offset` (number): offset keys (for example to simulate timestamps)\n- `--valueSize`: size of value, as a number in bytes or string with unit (e.g. `--valueSize 1kb`)\n- `--keyAsBuffer`, `--valueAsBuffer` (boolean): if not set, keys and values are written as strings (hex encoded).\n\nTips:\n\n- To benchmark writing sorted data, use `--keys seq` or `seqReverse`\n- Be mindful of `--concurrency` when using `--keys seq` or `seqReverse`: a high concurrency can counter the performance benefits of writing keys sequentially\n- To use the `zipfian` distribution with a negative skew, specify it as `--skew=-1` rather than `--skew -1` (which would be interpreted as a flag).\n\n### `batch-put`\n\nPerform concurrent `batch()` operations. Same as `put`, but in batches rather than singular puts. Options:\n\n- `--batchSize`: default 1000, must be a multiple of 10, maximum 1000\n- `--chained`: boolean flag, default false, use chained batch\n- `--concurrency`: default 1\n- Other options are the same as of the `put` benchmark, see above.\n\n### `get`\n\nPerform `get()` operations. Inserts `-n` sequential keys into the database, then reads them (in random order by default). Records the Simple Moving Average (SMA) of the duration of the last 1000 reads, as well as the Cumulative Moving Average (CMA) of the throughput in MB/s. Options:\n\n- `-n`: amount of operations, default 1e6\n- `--get`: specify options for `get()` using subargs, for example `--get [ --no-fillCache ]`.\n- `--concurrency`: default 1\n- `--keys` (string): one of:\n  - `random` (default): read pseudo-random numeric keys (0-N) with a certain probability `distribution`\n  - `seq`: read non-random, sequential numeric keys (0-N)\n  - `seqReverse`: same keys but in reverse (N-0)\n- `--values` (string): one of:\n  - `random` (default): write pseudo-random values\n  - `empty`: write zero-length values or zero-filled if `valueSize` is set\n- `--seed` (string): seed to use for random numbers, defaults to `'seed'`\n- `--distribution` (string): one of [`zipfian`](https://github.com/vweevers/zipfian-integer), `uniform` (default)\n- `--skew` (floating-point number): Zipfian skew (default 0)\n- `--offset` (number): offset keys (for example to simulate timestamps)\n- `--valueSize`: size of value, as a number in bytes or string with unit (e.g. `--valueSize 1kb`).\n- `--valueEncoding`: valueEncoding option for `get()`. Defaults to none which means the default of the db will be used.\n\n### `iterate`\n\nYet to document.\n\n### `stream`\n\nYet to document.\n\n### `self-distribution`\n\n_Not a benchmark, but a temporary cheat to reuse the tooling we have here to test (and visualize) some of the internals. Needs a valid `target` argument, same as real benchmarks, although that argument is not actually used._\n\nGenerate keys with a certain order and probability distribution. Options:\n\n- `-n`: amount of keys to generate, default 5e3\n- Other options are passed to [`keyspace`](https://github.com/vweevers/keyspace)\n\nExample:\n\n```\nlevel-bench run self-distribution memory-level -b [ --distribution zipfian --skew 1 ]\nlevel-bench run self-distribution memory-level -b [ --distribution zipfian --skew=-1 ]\nlevel-bench run self-distribution memory-level -b [ --keys seq ]\nlevel-bench plot self-distribution\n```\n\n\u003c!-- ### Other ideas\n\n- Write batches in different sizes (feature: define a matrix)\n- Write while increasing the number of open iterators (and thus snapshots) --\u003e\n\n## Limitations\n\nThe target `abstract-level` implementation must take a `location` as its first argument (if persistent) or ignore that argument (if transient). Options are passed to both the constructor with the signature `(location, options)` and to `db.open(options, callback)`.\n\n## Contributing\n\n[`Level/bench`](https://github.com/Level/bench) is an **OPEN Open Source Project**. This means that:\n\n\u003e Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.\n\nSee the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.\n\n## Donate\n\nSupport us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work.\n\n## License\n\n[MIT](LICENSE)\n\n[level-badge]: https://leveljs.org/img/badge.svg\n","funding_links":["https://opencollective.com/level"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Fbench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevel%2Fbench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevel%2Fbench/lists"}