orlp / slotmap

Slotmap data structure for Rust
zlib License
1.16k stars 70 forks source link

Parallel insertion without Mutexing the slotmap? #102

Closed amancapy closed 1 year ago

amancapy commented 1 year ago

Some type of support for parallel insertion without having to Mutex the slotmap? Along the lines of

let keys = (0..100).into_par_iter().map(|i| {
    sm.insert(MyStruct{id: i ...})
}).collect();

Sorry if this is a flawed idea. But HashMaps can be generated with a par iterator so it shouldn't be fundamentally impossible to have something like this?

orlp commented 1 year ago

This would create overhead for those that do not access a slotmap from multiple threads. For the moment I have no such plans.