GitXplorerGitXplorer
a

benchman

public
4 stars
0 forks
2 issues

Commits

List of commits on branch master.
Verified
a8c531830d4a90c78e6f19816646656b587d6010

Update README.md

aakiradeveloper committed 3 years ago
Unverified
9a3d7c28b1fbe9373b647290191d446207e6c98d

v0.2.6

aakiradeveloper committed 3 years ago
Verified
07bdd18f351fc0c50c5677ec501e9c7b62d9294e

Merge pull request #9 from akiradeveloper/remove-channel

aakiradeveloper committed 3 years ago
Unverified
3297f2f8b90f24fea904acc02e2ed853c77b2034

remove use of channel

aakiradeveloper committed 3 years ago
Unverified
86558418d17b8b584884315e04525bb358ba4442

v0.2.5

aakiradeveloper committed 3 years ago
Unverified
1cfbe8e53471e0ebbbc3872412a50a81c6f3f4d9

Add comments

aakiradeveloper committed 3 years ago

README

The README file for this repository.

benchman

Crates.io documentation

2f5c999cf5f782f8d5ec224c9149aca9899849c6_l

Features

  • Focus on one-shot benchmark
  • RAII-style
  • Statistics (Average, Median, 95% and 99% percentile)
  • Colored output
  • Tagging
  • Nesting

Motivation

I guess there are two types of benchmarks.

One is a benchmark of a small and fast function in which we want the statistics from a million of iterations. For this type of benchmark, Criterion.rs is a good fit.

Another type is what I call one-shot benchmark.

You may have wanted to write a benchmark program like this.

let mut db = DB::new();

let t = Instant::now();
db.write(...);
println!("write: {:?}", t.elapsed());

let t = Instant::now();
db.read(...);
println!("read: {:?}", t.elapsed());

According to Criterion.rs #531, this type of benchmark is infeasible with Criterion.rs because Criterion is focusing on the first type.

That's why I started to create benchman.

RAII-style measurement

RAII is a good technique to manage resource access. My idea behind designing benchman is that stopwatch is like a resource because it is like a producer of a benchmark result that sends the result to the single central consumer and there is a strict rule that stopwatch shouldn't send the result twice.

With this idea, the library is designed like this.

let stopwatch = benchman.get_stopwatch("some_tag");
do_something();
drop(stopwatch);

// or

{
    let _sw = benchman.get_stopwatch("some_tag");
    do_something();
}

When the stopwatch is dropped, the measurement result is sent to the central database.

Screenshot

スクリーンショット 2021-12-18 12 42 40

Author

Akira Hayakawa (@akiradeveloper)