{"id":13737261,"url":"https://github.com/disruptek/criterion","last_synced_at":"2025-07-23T21:08:53.655Z","repository":{"id":78132159,"uuid":"293371732","full_name":"disruptek/criterion","owner":"disruptek","description":"statistics-driven micro-benchmarking framework","archived":false,"fork":false,"pushed_at":"2025-01-10T18:53:44.000Z","size":302,"stargazers_count":24,"open_issues_count":2,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T16:18:19.801Z","etag":null,"topics":["benchmark","criterion","lemonboy","measurement","metrics","micro","nim","performance","statistics"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/disruptek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"disruptek"}},"created_at":"2020-09-06T22:28:12.000Z","updated_at":"2025-01-10T18:51:10.000Z","dependencies_parsed_at":"2024-01-06T12:08:33.957Z","dependency_job_id":"fa93073e-0c5f-4c8a-a791-5dbb3d266372","html_url":"https://github.com/disruptek/criterion","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fcriterion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fcriterion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fcriterion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/disruptek%2Fcriterion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/disruptek","download_url":"https://codeload.github.com/disruptek/criterion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065281,"owners_count":21041872,"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":["benchmark","criterion","lemonboy","measurement","metrics","micro","nim","performance","statistics"],"created_at":"2024-08-03T03:01:38.771Z","updated_at":"2025-04-09T16:18:48.430Z","avatar_url":"https://github.com/disruptek.png","language":"Nim","funding_links":["https://github.com/sponsors/disruptek"],"categories":["Development Tools"],"sub_categories":["Benchmarking"],"readme":"# criterion\n\n[![Test Matrix](https://github.com/disruptek/criterion/workflows/CI/badge.svg)](https://github.com/disruptek/criterion/actions?query=workflow%3ACI)\n[![GitHub release (latest by date)](https://img.shields.io/github/v/release/disruptek/criterion?style=flat)](https://github.com/disruptek/criterion/releases/latest)\n![Minimum supported Nim version](https://img.shields.io/badge/nim-1.0.8%2B-informational?style=flat\u0026logo=nim)\n[![License](https://img.shields.io/github/license/disruptek/criterion?style=flat)](#license)\n\nA statistics-driven micro-benchmarking framework heavily inspired by the\nwonderful [criterion](https://github.com/bos/criterion) library for Haskell;\noriginally created by [LemonBoy](https://github.com/LemonBoy).\n\n## Status\n\nWorks, API is still not 100% stable yet.\n\n## Example\n\n```nim\nimport criterion\n\nvar cfg = newDefaultConfig()\n\nbenchmark cfg:\n  func fib(n: int): int =\n    case n\n    of 0: 1\n    of 1: 1\n    else: fib(n-1) + fib(n-2)\n\n  # on nim-1.0 you have to use {.measure: [].} instead\n  proc fib5() {.measure.} =\n    var n = 5\n    blackBox fib(n)\n\n  # ... equivalent to ...\n\n  iterator argFactory(): int =\n    for x in [5]:\n      yield x\n\n  proc fibN(x: int) {.measure: argFactory.} =\n    blackBox fib(x)\n\n  # ... equivalent to ...\n\n  proc fibN1(x: int) {.measure: [5].} =\n    blackBox fib(x)\n```\n\nGives the following output:\n![fib](docs/fib.svg \"fib\")\n\nA bit too much info? Just set `cfg.brief = true` and the results will be output\nin a condensed format:\n\n![brief](docs/brief.svg \"brief\")\n\nMuch easier to parse, isn't it?\n\nIf you need to pass more than a single argument to your benchmark fixture just\nuse a tuple: they are automagically unpacked at compile-time.\n\n```nim\nimport criterion\n\nlet cfg = newDefaultConfig()\n\nbenchmark cfg:\n  proc foo(x: int, y: float) {.measure: [(1,1.0),(2,2.0)].} =\n    discard x.float + y\n```\n\n## Export the measurements\n\nIf you need the measurement data in order to compare different benchmarks, to\nplot the results or to post-process them you can do so by adding a single line\nto your benchmark setup:\n\n```nim\nlet cfg = newDefaultConfig()\n\n# Your usual config goes here...\ncfg.outputPath = \"my_benchmark.json\"\n\nbenchmark(cfg):\n  # Your benchmark code goes here...\n```\n\nThe data will be dumped once the block has been completed into a json file\nthat's ready for consumption by other tools.\n\n## Documentation\nSee [the documentation for the criterion module](https://disruptek.github.io/criterion/criterion.html) as generated directly from the source.\n\n## More Test Output\n\n[The source of the `many` test.](https://github.com/disruptek/criterion/blob/master/tests/many.nim)\n\n![many](docs/many.svg \"many\")\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisruptek%2Fcriterion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdisruptek%2Fcriterion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdisruptek%2Fcriterion/lists"}