Clarification about skip_vector purpose
jeffreyrogers opened this issue · comments
I found this repo from your blog post on cache optimizing a priority queue and have learned a lot by looking at the code. I am curious about the skip_vector. At first I thought maybe this was an alternative name for a skip list, since that is the only data structure I am familiar with that has a similar name, but reading through the implementation this appears to be similar to the standard library vector with some optimizations that maybe make it more performant. Is this correct? Besides performance is there any reason to prefer the skip_vector over a normal vector?
Also, does the "skip" part of the name have any meaning besides creating a distinction between the standard library vector and this implementation?
Thanks.
I really don't remember. Keep in mind it's been many years since I wrote it. Looking at the code, the one thing I see that differs from a std::vector<>
is the block_size
template parameter, that only seems to have an effect on the 1st memory allocation. I would probably just use a std::vector<>
if I wrote this today. In fact, the slightly simplified implementation used in the C++OnSea presentation What do you mean by "Cache Friendly"? is based on a std::vector<>
.
Thanks!