{"id":17315279,"url":"https://github.com/frando/nanobench-utils","last_synced_at":"2025-07-19T18:08:56.800Z","repository":{"id":136980762,"uuid":"263756434","full_name":"Frando/nanobench-utils","owner":"Frando","description":null,"archived":false,"fork":false,"pushed_at":"2020-07-17T15:29:11.000Z","size":6,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T01:32:44.163Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Frando.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-13T22:24:27.000Z","updated_at":"2020-07-17T15:29:13.000Z","dependencies_parsed_at":"2023-04-01T04:36:44.100Z","dependency_job_id":null,"html_url":"https://github.com/Frando/nanobench-utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Frando/nanobench-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fnanobench-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fnanobench-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fnanobench-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fnanobench-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frando","download_url":"https://codeload.github.com/Frando/nanobench-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frando%2Fnanobench-utils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265982909,"owners_count":23859576,"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","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":[],"created_at":"2024-10-15T13:07:23.857Z","updated_at":"2025-07-19T18:08:56.791Z","avatar_url":"https://github.com/Frando.png","language":"JavaScript","readme":"# nanobench-utils\n\nUtility functions for timers and benchmarks. Works well with [nanobench](https://github.com/mafintosh/nanobench).\n\n```\nnpm install nanobench-utils\n```\n\n## API\n\n\n``` \nconst { clock, memory } = require('nanobench-utils')\nconst bench = require('nanobench-utils/nanobench')\n```\n\n### const bench = require('nanobench-utils/nanobench')\n\nUsage as with nanobench. Additional methods on the `b` benchmark object provided are:\n\n* `b.throughput(bytes)`: Set the throughput produced by this benchmark, to be logged as bytes per second.\n\n* `b.time(name)`: Start a new timer `name`\n\n* `b.timeLog(name, [message])`: Log the current time of timer `name`\n\n* `b.memory([message])`: Log the current memory usage. The first diff is towards the start of the benchmark.\n\nThe utilities are also exported directly:\n\n### const timer = clock([name])\n\nStart a new timer with optional name\n\n* `timer.throughput(bytes)`: Set the throughput produced during this timer, to be logged as bytes per second.\n\n* `timer.log([message])`: Log elapsed time with optional message.\n\n* `timer.debug([message])`: As log, but print with [debug](https://github.com/visionmedia/debug) (on the `time` target)\n\n* `timer.ns()`: get elapsed time in nanoseconds.\n\n### const mem = memory(gc = true)\n\nMeasure memory usage. If `node` is run with `--expose-gc`, the garbage collector is run before logging memory. This can be disabled with `gc = false`.\n\n* `memory.log([message])`: Log current memory usage and diff to last measurement, with optional message.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrando%2Fnanobench-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrando%2Fnanobench-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrando%2Fnanobench-utils/lists"}