Crates.io | mempool |
lib.rs | mempool |
version | 0.3.1 |
source | src |
created_at | 2016-03-22 02:36:05.432894 |
updated_at | 2016-04-07 20:05:41.743895 |
description | A fast thread safe memory pool for reusing allocations. |
homepage | https://github.com/BurntSushi/mempool |
repository | https://github.com/BurntSushi/mempool |
max_upload_size | |
id | 4519 |
size | 21,055 |
This crate provides a fast thread safe memory pool for reusing allocations. It aggressively optimizes for the single-threaded use case, but gracefully supports access from multiple threads simultaneously. In particular, values in a pool may not be shared across threads.
Dual-licensed under MIT or the UNLICENSE.
http://burntsushi.net/rustdoc/mempool/
To use this crate, add mempool
as a dependency to your project's
Cargo.toml
:
[dependencies]
mempool = "0.3"
This crate currently uses the mempool_get_put_tls
approach.
test bench::crossbeam_ms_get_put ... bench: 105 ns/iter (+/- 4)
test bench::crossbeam_seg_get_put ... bench: 87 ns/iter (+/- 25)
test bench::crossbeam_treiber_get_put ... bench: 93 ns/iter (+/- 1)
test bench::mempool_get_put_tls ... bench: 1 ns/iter (+/- 0)
test bench::mpmc_get_put ... bench: 30 ns/iter (+/- 0)
test bench::mutex_get_put ... bench: 46 ns/iter (+/- 0)
I needed a very fast way to reuse allocations across multiple threads, potentially optimizing single threaded use over multithreaded use.
The current implementation is very fast for single threaded use, but probably slower than it needs to be for multithreaded use.