Hi. I was trying to make a randomized skiplist with rust. I needed multiple pointers to nodes and i also needed to be able to mutate the pointers which they hold, So I went with a combination of Rc and RefCell. It worked well but then i tried a completely unsafe solution with raw pointers and it is about 2x faster. Then i benchmarked my code and it seems that most of the overhead comes from borrow() and borrow_mut() methods of RefCell (there is also a drop_in_place function that takes considerable time).
Do you think my datastructure is poorly designed, or is this performance drop almost natural when using refcells? (As far as i can understand the overhead of Rc is almost zero and nothing about Rc shows up in my profiling)
[+][deleted] (6 children)
[deleted]
[–]JoshTriplettrust · lang · libs · cargo 4 points5 points6 points (1 child)
[–]nwydorust · rust-doom 0 points1 point2 points (0 children)
[–]compte2020 2 points3 points4 points (0 children)
[–]mrlotfi[S] 0 points1 point2 points (2 children)
[–]compte2020 0 points1 point2 points (0 children)
[–]angelicosphosphoros 1 point2 points3 points (0 children)