ritemlcr

Crates.ioritemlcr
lib.rsritemlcr
version0.1.0
sourcesrc
created_at2021-03-26 17:46:34.720975
updated_at2021-03-26 17:46:34.720975
descriptionAn adaptive machine-learning-based cache tracker/replacement policy. From ticki's tfs/mlcr.
homepage
repositoryhttps://github.com/ritedb/ritenn
max_upload_size
id373906
size19,246
Chojan Shang (PsiACE)

documentation

https://docs.rs/ritemlcr

README

RiteMLCR: MLCR from TFS

MLCR: Machine-Learning-based Cache Replacement

MLCR trains a neural network to "guess" how long time will pass before the cache block is accessed again. In other words, it provides a qualified guess to approximate the ideal Bélády's algorithm without a time machine.

MLCR is slow, because it needs to train a neural network, but in many cases, the added precision pays off by greatly reducing the number of cache misses. As such, it should only be used when the cached medium is significantly slower than training the network (e.g. hard disks or internet downloads).

Usage

let mut cache = ritemlcr::Cache::new();

cache.insert(1);
cache.insert(2);
cache.insert(3);
cache.insert(4);
cache.insert(100);
cache.insert(200);

cache.touch(100);
cache.touch(100);
cache.touch(1);
cache.touch(2);
cache.touch(2);
cache.touch(2);

Credit

It is a fork of the crate mlcr , but some adjustments and improvements have been made to the code .

License

This library is licensed under either of:

at your option.

Commit count: 2

cargo fmt