linksplatform / doublets-rs

The Unlicense
5 stars 2 forks source link

Use buffered iterators to speed up the search #3

Open uselessgoddess opened 2 years ago

uselessgoddess commented 2 years ago

Currently, op_iter functions use Vec to collect op results to vec and returns vec.into_iter(). I recommend use buffered lock-free iterator generator crate - buter or similar

For example, it will look like this:

//! before
let mut vec = Vec::with_capacity(...);
self.each(..., |link| {
    vec.push(link);
    Continue
});
vec.into_iter()

//! after
let writer = self.buter.writer();
self.each(..., |link| {
    writer.extend(Some(link));
    Continue
});
writer.into_iter()
uselessgoddess commented 2 years ago

You also need to create benches to compare with the old implementation. Check out iter bench