lotsa

Crates.iolotsa
lib.rslotsa
version0.2.0
sourcesrc
created_at2019-07-03 17:37:44.436402
updated_at2022-05-19 16:01:29.895167
descriptionExecute lots of operations spread over any number of threads.
homepage
repositoryhttps://github.com/tidwall/lotsa.rs
max_upload_size
id145670
size5,362
Josh Baker (tidwall)

documentation

https://docs.rs/lotsa/

README

lotsa

license crates.io version documentation

Lotsa is a simple Rust library for executing lots of operations spread over any number of threads.

This is port of the Go library https://github.com/tidwall/lotsa.

Example

fn main() {
    // The `i` and `thread` params correspond to the op index and thread
    // number, respectively.
    lotsa::ops(100000, 1, |i, thread| {
        fibonacci(10);
    });
}

fn fibonacci(n: u32) -> u32 {
    match n {
        0 => 1,
        1 => 1,
        _ => fibonacci(n - 1) + fibonacci(n - 2),
    }
}

Outputs something like:

100000 ops in 0.061 secs (1,639,344 ops/sec)

Contact

Josh Baker @tidwall

License

Source code is available under the MIT License.

Commit count: 22

cargo fmt