arindas / generational-cache

Generational Arena based cache impls. in 100% safe, [no_std] compatible Rust.
https://docs.rs/generational-cache/
MIT License
6 stars 0 forks source link

Are there any benchmarks? #9

Open opensourcegeek opened 1 week ago

opensourcegeek commented 1 week ago

I like the idea of using arenas to back the cache. Do you have any benchmarks just to be able to compare it with other caching libraries like say Moka?

I wonder if it's worth creating one if there isn't one already.

arindas commented 1 week ago

There are no benchmarks at the moment. I can't really commit to writing a benchmark right now. If you are interested, a benchmark PR would be amazing.

arindas commented 1 week ago

That said there are a couple of differences:

Thank you for mentioning Moka!

arindas commented 1 week ago

To paint a complete picture, it would also be important to have benchmarks for different workloads with different key and value sizes and with or without concurrent access.

Right now one would need to wrap our cache in a Mutex or RwLock for safe concurrent access.

opensourcegeek commented 6 days ago

Oh ok - I didn't realise the whole cache needs to be behind a mutex or rwlock.

For my use case I need to cache the file contents. These files don't change (they'll be deleted but not updated). Because the cache size is configured, I was hoping I could just allocate for the whole cache once and I don't need to give the memory back. But it definitely helps to distribute the locking internally.