This bench is to compare with AvlTree and assess the need to implement a BTreeSet of our own.
platform: intel i7-8550U, rust 1.97.
Measured in million ops for different dataset sizes.
A boxed item is put into BTreeSet, comparable to an intrusive AvlTree.
#[derive(Default, Debug, PartialEq, PartialOrd, Ord, Eq)] struct IntNode { pub value: u32, } impl Borrow<u32> for Box<IntNode> { #[inline] fn borrow(&self) -> &u32 { &self.value } } fn new_intnode_box(i: u32) -> Box<IntNode> { Box::new(IntNode { value: i}) }
We can see insert_seq, insert_rand is slightly better, remove_seq, remove_rand. get_rand is the same, get_seq is better, iter is significantly better.
There was an error while loading. Please reload this page.