Skip to content

tensorush/zig-sieve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zig-sieve

CI CD DC LC

Zig implementation of SIEVE cache eviction algorithm.

🚀 Usage

  • Add sieve dependency to build.zig.zon.
zig fetch --save https://github.com/tensorush/zig-sieve/archive/<git_tag_or_commit_hash>.tar.gz
  • Use sieve dependency in build.zig.
const sieve_dep = b.dependency("sieve", .{
    .target = target,
    .optimize = optimize,
});
const sieve_mod = sieve_dep.module("sieve");
<compile>.root_module.addImport("sieve", sieve_mod);

📊 Benchmarks

  • Sequence: the time to cache and retrieve integer values.

    $ zig build bench -- -s
    Sequence: 28.833us
  • Composite: the time to cache and retrieve composite values.

    $ zig build bench -- -c
    Composite: 45.291us
  • Composite (normal): the time to cache and retrieve normally-distributed composite values.

    $ zig build bench -- -n
    Composite Normal: 135.25us