It is not about Keanu Reeves but a benchmark tool.

Related tags

Profiling benchman
Overview

benchman

Crates.io documentation

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-16 19 51 45

Author

Akira Hayakawa (@akiradeveloper)

You might also like...
The Bloat-Free Browser Game in Rust but in C and not in a Browser
The Bloat-Free Browser Game in Rust but in C and not in a Browser

rust-browser-game but native and rendered with SDL in C without the Browser The original idea of rust-browser-game is that the game.wasm module is com

This crate provide parsing fontconfig file but not yet complete all features

This crate provide parsing fontconfig file but not yet complete all features

A performant but not-so-accurate time and capacity based cache for Rust.

fastcache A performant but not-so-accurate time and capacity based cache for Rust. This crate provides an implementation of a time-to-live (TTL) and c

Benchmark tool for comparing with other runtimes.

Monoio Benchmark TCP ping-pong(not echo) is a common benchmark for network applications. We will use 1K ping-pong to test performance of different run

Verdun is a HTTP stress-test/benchmark tool written in Rust.
Verdun is a HTTP stress-test/benchmark tool written in Rust.

Verdun is a HTTP stress-test/benchmark tool written in Rust. 🦀 It supports testing a single URL, loading multiples URLs from a file or automatically navigating a website (auto discovery)

hb is an endpoint focused HTTP load testing / benchmark tool.

hb hb is an endpoint focused HTTP load testing / benchmark tool. Description The goal of hb is to provide a simple, robust tool to apply load against

rusty-riscy is a performance testing and system resource monitoring tool written in Rust to benchmark RISC-V processors.

rusty-riscy rusty-riscy is a performance testing and system resource monitoring tool written in Rust to benchmark RISC-V processors. Objectives To cre

A http server benchmark tool written in rust 🦀
A http server benchmark tool written in rust 🦀

rsb - rust benchmark rsb is a http server benchmark tool written in rust. The development of this tool is mainly inspired by the bombardier project, a

Blazing fast tool to benchmark Starknet sequencers 🦀

Gomu Gomu no Gatling Blazing fast tool to benchmark Starknet sequencers 🦀 . Installation From source git clone https://github.com/keep-starknet-stran

A simple disk benchmark tool.
A simple disk benchmark tool.

simple-disk-benchmark A simple disk benchmark tool. Operating Systems Currently, macOS and Linux are tested. Windows may work but is not tested. Devel

A micro-benchmark framework to use with cargo bench
A micro-benchmark framework to use with cargo bench

Glassbench is a micro-benchmark library with memory, to use with cargo bench. Why Run benchmarks and get a comparison with the previous execution carg

Benchmark over Node.js binding frameworks in Rust

Benchmark over Node.js binding frameworks in Rust

Benchmark for Rust and humans
Benchmark for Rust and humans

bma-benchmark Benchmark for Rust and humans What is this for I like testing different libraries, crates and algorithms. I do benchmarks on prototypes

Rust wrapper for COCO benchmark functions.
Rust wrapper for COCO benchmark functions.

Coco Rust bindings for the COCO Numerical Black-Box Optimization Benchmarking Framework. See https://github.com/numbbo/coco and https://numbbo.github.

Parses .off (Object File Format) files. This implementation follows this spec from the Princeton Shape Benchmark.

off-rs - A simple .off file parser Parses .off (Object File Format) files. This implementation follows this spec from the Princeton Shape Benchmark. S

Simple benchmark to compare different Kafka clients performance with similar configuration.

Kafka Producer Benchmark Simple benchmark to compare different clients performance against similar configuration. The project is relatively low tech a

SQL Benchmark derived from TPC-DS

SQLBench-DS Overview SQLBench-DS is a SQL benchmark derived from TPC-DS under the terms of the Transaction Processing Council's Fair Use Policy. This

A rust-based benchmark for BlueField SmartNICs.

Smartbench Smart-bench is a rust-based benchmarking tool for BlueField-series SmartNICs. The purpose is to enable easy testing of BlueField-series Sma

A benchmark of Rust/serde deserializers on configuration files

This program compares the time some serde deserializers take to deserialize some string into a configuration-like struct deriving Deserialize. The ben

Comments
  • fix test: drop stopwatch in the thread

    fix test: drop stopwatch in the thread

    This code is not as intended. The ownership of stopwatch should be dropped in in the spawned thread.

        fn test_benchman_spawn() {
            let benchman = BenchMan::new("spawn");
            for _ in 0..1 {
                let stopwatch = benchman.get_stopwatch("loop1");
                std::thread::spawn(move || {
                    let mut sum: u64 = 0;
                    for i in 0..1000000 {
                        sum += i;
                    }
                });
            }
    
    opened by akiradeveloper 1
Owner
Akira Hayakawa
I am just a very good Rust programmer.
Akira Hayakawa
A http server benchmark tool written in rust 🦀

rsb - rust benchmark rsb is a http server benchmark tool written in rust. The development of this tool is mainly inspired by the bombardier project, a

Michael 45 Apr 10, 2023
A micro-benchmark framework to use with cargo bench

Glassbench is a micro-benchmark library with memory, to use with cargo bench. Why Run benchmarks and get a comparison with the previous execution carg

Canop 36 Dec 14, 2022
Benchmark for Rust and humans

bma-benchmark Benchmark for Rust and humans What is this for I like testing different libraries, crates and algorithms. I do benchmarks on prototypes

Altertech 11 Jan 17, 2022
Rust wrapper for COCO benchmark functions.

Coco Rust bindings for the COCO Numerical Black-Box Optimization Benchmarking Framework. See https://github.com/numbbo/coco and https://numbbo.github.

Leopold Luley 1 Nov 15, 2022
A command-line benchmarking tool

hyperfine 中文 A command-line benchmarking tool. Demo: Benchmarking fd and find: Features Statistical analysis across multiple runs. Support for arbitra

David Peter 14.1k Jan 6, 2023
An intrusive flamegraph profiling tool for rust.

FLAME A cool flamegraph library for rust Flamegraphs are a great way to view profiling information. At a glance, they give you information about how m

null 631 Jan 3, 2023
A unix "time" like benchmarking tool on steroids

benchie Usage Binary Once Rust is installed (see step 1 in "Toolchain Setup"), you can easily install the latest version of benchie with: $ cargo inst

benchie 3 May 6, 2022
Elton is a benchmark utility written in rust aimed to be used to benchmark HTTP calls.

Elton Elton is an HTTP Benchmark utility with options to be used within an HTTP interface. Installation Elton is currently available via Docker or by

Emil Priver 5 Sep 22, 2023
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Dec 31, 2022