Crates.io | mem_btree |
lib.rs | mem_btree |
version | 0.3.2 |
source | src |
created_at | 2023-09-10 07:20:22.994367 |
updated_at | 2024-08-10 09:52:45.982119 |
description | A Data Structure of BTree Implemented with Rust, support snapshot. not use any unsafe lib. |
homepage | |
repository | https://github.com/ansjsun/mem_btree |
max_upload_size | |
id | 968697 |
size | 58,387 |
A Data Structure of BTree Implemented with Rust, support snapshot. not use any unsafe lib.
https://crates.io/crates/mem_btree
Although rust officially provides the BTreeMap library. But this library can not achieve copy/read on write, but also can not achieve snapshot, although you can use clone instead of but, clone's price is too expensive, so this project through a very simple way to achieve a snapshot of the BTree structure. The main idea is to use Arc in a freewheeling way, and then in the process of writing, clone all the pathway nodes, although this will cause the insertion speed to slow down. But compared to the memory operation of the slow is also limited slow.
5k kv insert
btree insert 120.064954ms
btreemap insert 73.882981ms
btreemap_arc insert 79.869725ms
btree get 102.721024ms
btreemap get 100.939223ms
btreemap_arc get 100.255662ms
btree clone 759ns
btreemap clone 453.955778ms
btreemap_arc clone 24.776548ms