]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/cuckoo-filters/cuckoo-filters.factor
endian: replaces io.binary and io.binary.fast.
[factor.git] / extra / benchmark / cuckoo-filters / cuckoo-filters.factor
1 USING: cuckoo-filters endian fry kernel math sequences ;
2 IN: benchmark.cuckoo-filters
3
4 : insert-data ( cuckoo-filter -- cuckoo-filter )
5     2,000 <iota> [ 4 >le ] map
6     10 swap '[ _ [ over cuckoo-insert drop ] each ] times ;
7
8 : test-hit ( cuckoo-filter -- cuckoo-filter )
9     10,000 100 4 >le '[ _ over cuckoo-lookup drop ] times ;
10
11 : test-miss ( cuckoo-filter -- cuckoo-filter )
12     100,000 12345 4 >le '[ _ over cuckoo-lookup drop ] times ;
13
14 : cuckoo-filters-benchmark ( -- )
15     2000 <cuckoo-filter> insert-data test-hit test-miss drop ;
16
17 MAIN: cuckoo-filters-benchmark