This code:
fn main() {
let rt = tokio::runtime::Builder::new_multi_thread().enable_all().worker_threads(32).build().unwrap();
let now = std::time::Instant::now();
let set: papaya::HashSet<u32> = papaya::HashSet::new();
println!("Papaya set build time: {:?}", now.elapsed());
let p = set.pin_owned();
std::thread::scope(|x| {
p.len();
});
}
Cargo.toml:
[package]
name = "papaya_test"
version = "0.1.0"
edition = "2024"
[dependencies]
papaya = "0.2.4"
tokio = { version = "1.51", features = ["full"] }
Prints:
Finished `release` profile [optimized] target(s) in 2.63s
Papaya set build time: 22.005689ms
When tokio rt line commented out:
Finished `release` profile [optimized] target(s) in 2.12s
Papaya set build time: 74.486µs
This code:
Cargo.toml:
Prints:
When tokio rt line commented out: