@@ -96,13 +96,13 @@ Running the [example](./examples/main.go) you can see it is compared to:
9696
9797| Algorithm | Miss Count |
9898| -----------| ------------|
99+ | ** sieve** | 328,766 |
100+ | ** sieve-single-thread** | 328,766 |
99101| golang-sieve | 328,766 |
100- | ** sieve** | 338,193 |
101- | ** sieve-single-thread** | 338,193 |
102102| s3-fifo | 345,081 |
103103| golang-lru | 424,727 |
104104
105- Both sieve variants achieve better hit rate than s3-fifo ( ~ 6,888 fewer misses) and golang-lru ( ~ 86,534 fewer misses) .
105+ All sieve variants achieve the best hit rate with ~ 16,315 fewer misses than s3-fifo and ~ 95,961 fewer than LRU .
106106
107107## Benchmarks
108108
@@ -111,29 +111,29 @@ goos: darwin
111111goarch: arm64
112112cpu: Apple M4 Pro
113113
114- BenchmarkSimple-14 21,206,392 48.46 ns/op 80 B/op 1 allocs/op
115- BenchmarkSimpleSingleThread-14 22,182,102 48.22 ns/op 80 B/op 1 allocs/op
116- BenchmarkSimpleLRU-14 27,166,786 41.48 ns/op 80 B/op 1 allocs/op
117- BenchmarkSimpleS3FIFO-14 6,465,110 157.6 ns/op 192 B/op 4 allocs/op
118- BenchmarkSimpleGolangSieve-14 11,521,432 97.60 ns/op 136 B/op 3 allocs/op
119-
120- BenchmarkBigInput-14 1,000,000,000 0.03507 ns/op 0 B/op 0 allocs/op
121- BenchmarkBigInputSingleThread-14 1,000,000,000 0.03468 ns/op 0 B/op 0 allocs/op
122- BenchmarkBigInputLRU-14 1,000,000,000 0.03241 ns/op 0 B/op 0 allocs/op
123- BenchmarkBigInputS3FIFO-14 1,000,000,000 0.04485 ns/op 0 B/op 0 allocs/op
124- BenchmarkBigInputGolangSieve-14 1,000,000,000 0.02771 ns/op 0 B/op 0 allocs/op
125-
126- BenchmarkSimpleWithTTL-14 25,725,212 47.24 ns/op 80 B/op 1 allocs/op
127- BenchmarkSimpleConcurrent-14 1,000,000,000 0.0000209 ns/op 0 B/op 0 allocs/op
128- BenchmarkSimpleConcurrentWithTTL-14 1,000,000,000 0.0000333 ns/op 0 B/op 0 allocs/op
114+ BenchmarkSimple-14 24,632,971 49.41 ns/op 80 B/op 1 allocs/op
115+ BenchmarkSimpleSingleThread-14 22,632,132 50.01 ns/op 80 B/op 1 allocs/op
116+ BenchmarkSimpleLRU-14 26,519,824 44.32 ns/op 80 B/op 1 allocs/op
117+ BenchmarkSimpleS3FIFO-14 7,120,837 156.5 ns/op 192 B/op 4 allocs/op
118+ BenchmarkSimpleGolangSieve-14 10,178,019 102.4 ns/op 136 B/op 3 allocs/op
119+
120+ BenchmarkBigInput-14 1,000,000,000 0.03514 ns/op 0 B/op 0 allocs/op
121+ BenchmarkBigInputSingleThread-14 1,000,000,000 0.03469 ns/op 0 B/op 0 allocs/op
122+ BenchmarkBigInputLRU-14 1,000,000,000 0.03214 ns/op 0 B/op 0 allocs/op
123+ BenchmarkBigInputS3FIFO-14 1,000,000,000 0.04581 ns/op 0 B/op 0 allocs/op
124+ BenchmarkBigInputGolangSieve-14 1,000,000,000 0.02759 ns/op 0 B/op 0 allocs/op
125+
126+ BenchmarkSimpleWithTTL-14 25,683,086 49.15 ns/op 80 B/op 1 allocs/op
127+ BenchmarkSimpleConcurrent-14 1,000,000,000 0.0000402 ns/op 0 B/op 0 allocs/op
128+ BenchmarkSimpleConcurrentWithTTL-14 1,000,000,000 0.0000300 ns/op 0 B/op 0 allocs/op
129129```
130130
131131### Summary
132132
133133| Metric | sieve | sieve-single-thread | golang-lru | s3-fifo | golang-sieve |
134134| --------| -------| ---------------------| ------------| ---------| --------------|
135- | Hit Rate | Good | Good | Worst | Good | Best |
136- | Speed (simple) | 48.46 ns | 48.22 ns | 41.48 ns | 157.6 ns | 97.60 ns |
135+ | Hit Rate | Best | Best | Worst | Good | Best |
136+ | Speed (simple) | 49.41 ns | 50.01 ns | 44.32 ns | 156.5 ns | 102.4 ns |
137137| Memory | 80 B/op | 80 B/op | 80 B/op | 192 B/op | 136 B/op |
138138| Allocations | 1 | 1 | 1 | 4 | 3 |
139139
0 commit comments