servo / uluru

A simple, fast, LRU cache implementation.
Mozilla Public License 2.0
190 stars 20 forks source link

Storing more than 65535 items?... #20

Open let4be opened 3 years ago

let4be commented 3 years ago

Why such an arbitrary low limit?

https://github.com/servo/uluru/blob/81d33cbe6866d1c18947ad029b01f26d9910a1da/src/lib.rs#L90

let4be commented 3 years ago

I guess it has to do with everything living on stack and each entry needs a prev/next indexes(u16) = 4 bytes vs 8 bytes if cache made larger... Could probably benefit from u16 made into a generic parameter? (thread stack size can be configured)

mbrubeck commented 3 years ago

If you need to store thousands of items, uluru is probably not a very good solution, because performing a lookup requires scanning through every single item (in the worst case). This library is designed for caches that store a small number of items.