{"id":29889956,"url":"https://github.com/osiewicz/calliper","last_synced_at":"2025-07-31T22:20:55.251Z","repository":{"id":65423256,"uuid":"565459894","full_name":"osiewicz/calliper","owner":"osiewicz","description":"Callgrind-based benchmark harness written in Rust","archived":false,"fork":false,"pushed_at":"2023-08-02T16:53:04.000Z","size":122,"stargazers_count":28,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-05T14:10:51.899Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osiewicz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-13T13:38:40.000Z","updated_at":"2025-05-07T19:31:51.000Z","dependencies_parsed_at":"2023-02-19T01:45:24.512Z","dependency_job_id":null,"html_url":"https://github.com/osiewicz/calliper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/osiewicz/calliper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiewicz%2Fcalliper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiewicz%2Fcalliper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiewicz%2Fcalliper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiewicz%2Fcalliper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osiewicz","download_url":"https://codeload.github.com/osiewicz/calliper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osiewicz%2Fcalliper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268126342,"owners_count":24200288,"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-07-31T02:00:08.723Z","response_time":66,"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":[],"created_at":"2025-07-31T22:20:52.134Z","updated_at":"2025-07-31T22:20:55.211Z","avatar_url":"https://github.com/osiewicz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCalliper\u003c/h1\u003e\nCalliper is a Callgrind-based benchmarking harness with few-too-many knobs sticking out.\n\n[![Docs](https://docs.rs/calliper/badge.svg)](https://docs.rs/calliper)\n\n**State**: There's still a lot to do, but Calliper should be usable now. Note that I plan to break API prior to 1.0.0 arbitrarily in minor versions.\n## Table of contents\n\n- [Table of contents](#table-of-contents)\n  - [Usage](#usage)\n  - [Examples](#examples)\n  - [License](#license)\n  - [Acknowledgmenets](#acknowledgements)\n\n## Usage\nTo use Calliper, you must have [Valgrind](https://valgrind.org/) installed. \n\nTo write your first benchmark with Calliper, add the following to your `Cargo.toml`:\n```toml\n[dev-dependencies]\ncalliper = \"0.1.4\"\n\n[[bench]]\nname = \"my_first_calliper_benchmark\"\nharness = false\n```\n\nThen, create a file at `$PROJECT/benches/my_first_calliper_benchmark.rs` with the following contents:\n\n```rust\nuse calliper::utils::black_box;\nuse calliper::{Runner, Scenario};\n\n#[inline(never)]\n#[no_mangle]\nfn binary_search_impl(haystack: \u0026[u8], needle: u8) -\u003e Result\u003cusize, usize\u003e {\n    haystack.binary_search(\u0026needle)\n}\nfn bench_binary_search() {\n    let range = (0..255).collect::\u003cVec\u003c_\u003e\u003e();\n    let _ = black_box(binary_search_impl(black_box(\u0026range), black_box(253)));\n}\n\n#[inline(never)]\n#[no_mangle]\nfn linear_search_impl(haystack: \u0026[u8], needle: u8) -\u003e Option\u003cusize\u003e {\n    haystack.iter().position(|n| *n == needle)\n}\n\nfn bench_linear_search() {\n    let range = (0..255).collect::\u003cVec\u003c_\u003e\u003e();\n    black_box(linear_search_impl(black_box(\u0026range), black_box(253)));\n}\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let runner = Runner::default();\n    let benches = [\n        Scenario::new(bench_linear_search),\n        Scenario::new(bench_binary_search),\n    ];\n    if let Some(results) = runner.run(\u0026benches)? {\n        for res in results.into_iter() {\n            println!(\"{}\", res.parse());\n        }\n    }\n    Ok(())\n}\n```\n\nNow the benchmark can be executed with `cargo bench`. \n\nMore sophisticated examples can be found in benches folder of this repository.\n\n## License\n\nThis project is licensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   https://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   https://opensource.org/licenses/MIT)\n\nat your option.\n\n## Acknowledgements\nCalliper is inspired by [Iai benchmarking harness](https://github.com/bheisler/iai).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiewicz%2Fcalliper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosiewicz%2Fcalliper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosiewicz%2Fcalliper/lists"}