package
0.0.0-20250214054825-048a77899096
Repository: https://github.com/dgraph-io/benchmarks.git
Documentation: pkg.go.dev

# README

ristretto bench

This is a comprehensive benchmarking suite for Go cache libraries. We measure cache performance by tracking raw throughput and hit ratios, for a variety of access distributions / trace files.

how to run

1. download trace files using git lfs (if needed)

[./ristretto]$ git lfs fetch --all

2. compile bench

[./ristretto]$ go build

3. run bench with parameters

[./ristretto]$ ./ristretto -suite    [ all | speed | hits ] 
                           -cache    [ all | ristretto ]
                           -parallel [ 1... ]
                           -path     [ output_file.csv ]

Note: The parallel flag is the goroutine multiplier to use when running the benchmarks. This is useful for simulating contention.

4. use the output.csv file

The output CSV file is useful for creating charts and comparing implementations. The column headers are used as follows:

  • name: the cache implementation (from cache.go)
  • label: the benchmark (from generate.go)
  • go: the number of goroutines running in parallel
  • mop/s: million operations per second (e.g. 9 mop/s = 9,000,000 operations per second)
  • ns/op: nanoseconds per operation
  • ac: allocations per operation
  • byt: bytes allocated per operation
  • hits: total number of hits counted during the benchmark
  • misses: total number of misses counted during the benchmark
  • ratio: the percentage of hits / (hits + misses)

Here's an example of the output when running the "all" (speed + hits) suite:

name       , label         , go,  mop/s,  ns/op, ac, byt, hits    , misses  ,   ratio 
ristretto  , hits-zipf     ,  0, ------, ------, --, ---, 00059405, 00040595,  59.40%
ristretto  , hits-lirs-gli ,  0, ------, ------, --, ---, 00003480, 00002535,  57.86%
ristretto  , hits-lirs-loop,  0, ------, ------, --, ---, 00098988, 00001012,  98.99%
ristretto  , hits-arc-ds1  ,  0, ------, ------, --, ---, 00007647, 00092353,   7.65%
ristretto  , hits-arc-p3   ,  0, ------, ------, --, ---, 00001471, 00098529,   1.47%
ristretto  , hits-arc-p8   ,  0, ------, ------, --, ---, 00002102, 00097898,   2.10%
ristretto  , hits-arc-s3   ,  0, ------, ------, --, ---, 00000183, 00099817,   0.18%
ristretto  , get-same      ,  4,  19.75,     50, 00, 000, --------, --------, -------
ristretto  , get-zipf      ,  4,  18.56,     53, 00, 000, --------, --------, -------
ristretto  , set-get       ,  4,   3.51,    284, 01, 034, --------, --------, -------
ristretto  , set-same      ,  4,   9.04,    110, 02, 064, --------, --------, -------
ristretto  , set-zipf      ,  4,   8.94,    111, 02, 064, --------, --------, -------
ristretto  , set-get-zipf  ,  4,  17.98,     55, 00, 000, --------, --------, -------

The dashed-out blocks are to be ignored. Because of the nature of those benchmarks, those blocks could be misleading if they were left visible.

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
HitsZipf records the hit ratio using a Zipfian distribution.
Labels returns the column headers of the CSV data.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewResult extracts the data we're interested in from a BenchmarkResult.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Benchmark is used to generate benchmarks.
No description provided by the author
No description provided by the author
Log is the primary unit of the CSV output files.
No description provided by the author
Result is a wrapper for testing.BenchmarkResult that adds fields needed for our CSV data.

# Interfaces

No description provided by the author