{"id":23090747,"url":"https://github.com/juzi5201314/bench-rs","last_synced_at":"2025-07-09T17:08:24.217Z","repository":{"id":57505865,"uuid":"297328598","full_name":"juzi5201314/bench-rs","owner":"juzi5201314","description":"A benchmark library.","archived":false,"fork":false,"pushed_at":"2020-10-03T03:40:18.000Z","size":70,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-15T10:55:52.029Z","etag":null,"topics":["bench","bench-rs","benchmark","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/juzi5201314.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-21T12:10:57.000Z","updated_at":"2023-08-07T01:22:51.000Z","dependencies_parsed_at":"2022-09-26T17:51:46.282Z","dependency_job_id":null,"html_url":"https://github.com/juzi5201314/bench-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/juzi5201314/bench-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzi5201314%2Fbench-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzi5201314%2Fbench-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzi5201314%2Fbench-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzi5201314%2Fbench-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juzi5201314","download_url":"https://codeload.github.com/juzi5201314/bench-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juzi5201314%2Fbench-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502167,"owners_count":23618557,"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":["bench","bench-rs","benchmark","rust"],"created_at":"2024-12-16T21:16:07.348Z","updated_at":"2025-07-09T17:08:24.138Z","avatar_url":"https://github.com/juzi5201314.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bench-rs\n\n![Rust](https://github.com/juzi5201314/bench-rs/workflows/Rust/badge.svg)\n[![docs.rs](https://docs.rs/bench-rs/badge.svg)](https://docs.rs/bench-rs)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/juzi5201314/bench-rs)\n![Downloads](https://img.shields.io/crates/d/bench-rs)\n![GitHub](https://img.shields.io/github/license/juzi5201314/bench-rs)\n[![Crates.io](https://img.shields.io/crates/v/bench-rs)](https://crates.io/crates/bench-rs)\n\nA benchmark library.\n\n- [x] Stable rust (no black_box)\n- [x] Beautiful output\n- [x] Async support\n- [x] Custom async runtime\n- [x] Memory usage\n- [x] Custom formatting\n- [ ] Intuitive numerical units\n- [x] Support custom memory allocator\n\n### Examples\n```\n$ cargo test --release --color=always -q --package bench-rs --test bench --no-fail-fast -- --test-threads=1 --nocapture\n```\nLook `./tests/bench.rs`\n\n![image.png](https://i.loli.net/2020/09/23/RsCfvr4OIVyj9Lc.png)\n\n### black_box\nI don't know how to implement the black box.\n\nPlease use [core::hint::black_box](https://doc.rust-lang.org/core/hint/fn.black_box.html). (unstable)\n\nIf you have a better idea, welcome to submit a pull request or open an issue\n\n### global_allocator\nIn order to detect Memory usage, `bench-rs` modified global_allocator.\nThis will make it impossible to use other allocators.\nIf you need to use other allocator: \n\n\nChange your allocator: (if your allocator is `std::alloc::System`)\n```\nuse std::alloc::System;\nuse bench_rs::{TrackAllocator, new_allocator};\n\n#[global_allocator]\npub static GLOBAL: TrackAllocator\u003cSystem\u003e = new_allocator!(System);\n```\n\nTurn off default features:\n```\n[dependencies]\nbench-rs = { version = \"*\", default-features = false }\n```\n\nImport the allocator named `GLOBAL`:\n```\nuse bench_rs::bench;\nuse yourlib::GLOBAL;\n\n#[bench]\nfn ...\n```\nIf your allocator name is not `GLOBAL`, please set its alias to `GLOBAL`:\n\n`use yourlib::OtherAllocator as GLOBAL`\n\nBecause the bencher-macro will look for `GLOBAL.counter()` and `GLOBAL.peak()` \nat the same level of the bench function.\n\n---\n\n\u003e I am a rust beginner, please correct me if the code is bad. Thank you\n\u003e\n\u003e Contributions welcome","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuzi5201314%2Fbench-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuzi5201314%2Fbench-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuzi5201314%2Fbench-rs/lists"}