33 releases
Uses new Rust 2024
new 0.1.24 | Jul 23, 2025 |
---|---|
0.1.23 | Jul 14, 2025 |
0.1.19 | Jun 29, 2025 |
0.1.11 | May 8, 2025 |
0.0.6 | Mar 26, 2025 |
#96 in Caching
1,143 downloads per month
580KB
8K
SLoC
On many-processor systems with multiple memory regions, there is an extra cost associated with accessing data in physical memory modules that are in a different memory region than the current processor:
- Cross-memory-region loads have higher latency (e.g. 100 ns local versus 200 ns remote).
- Cross-memory-region loads have lower throughput (e.g. 50 Gbps local versus 10 Gbps remote).
This crate provides the capability to cache frequently accessed shared data sets in the local memory region, speeding up reads when the data is not already in the local processor caches. You can think of it as an extra level of caching between L3 processor caches and main memory.
// `RegionCachedExt` provides required extension methods on region-cached
// static variables, such as `with_cached()` and `set_global()`.
use region_cached::{RegionCachedExt, region_cached};
region_cached!(static FAVORITE_COLOR: String = "blue".to_string());
FAVORITE_COLOR.with_cached(|color| {
println!("My favorite color is {color}");
});
FAVORITE_COLOR.set_global("red".to_string());
More details in the package documentation.
This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.
Dependencies
~2–25MB
~335K SLoC