Cuneiform: Cache optimizations for Rust, revived from the slabs of Sumer.
This crate provides a proc macro attribute to optimize CPU cache operations for user defined structs. Cuneiform can take various arguments at attribute position:
hermetic = true|false
(default istrue
when#[cuneiform]
)- Hermetic enables cuneiform to detect cache sizes from OSes which have API to fetch.
- Currently, hermetic argument works only Linux kernel 2.6.32 and above.
- If system is different than supported systems it falls back to
slab
s. slab = "board_or_architecture_name
(e.g.#[cuneiform(slab = "powerpc_mpc8xx")]
)- Slabs are either embedded system boards or other specific architecture.
- Slab checking have two stages:
- First, it checks the given board/architecture if exist.
- If not slabs fall back to Rust supported architectures.
- Still architecture is not detected, it will fall back to default values.
force = u8
(e.g.#[cuneiform(force = 16)]
)- Forces a given cache alignment. Overrides all other systems mentioned above.
[]
= "0.1"
Examples
Basic usage can be:
use *;
// Defaults to `hermetic = true`
Targeting specific architecture:
use *;
Overriding the default cache alignment:
use *;