benchmark.cuckoo-filters: adding a new benchmark.

clean-macosx-x86-64
John Benediktsson 2019-11-06 18:17:29 -08:00
parent 12dc9e7ab7
commit 4ece7a6ca0
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
USING: cuckoo-filters fry io.binary kernel math sequences ;
IN: benchmark.cuckoo-filters
: insert-data ( cuckoo-filter -- cuckoo-filter )
2,000 <iota> [ 4 >le ] map
10 swap '[ _ [ over cuckoo-insert drop ] each ] times ;
: test-hit ( cuckoo-filter -- cuckoo-filter )
10,000 100 4 >le '[ _ over cuckoo-lookup drop ] times ;
: test-miss ( cuckoo-filter -- cuckoo-filter )
100,000 12345 4 >le '[ _ over cuckoo-lookup drop ] times ;
: cuckoo-filters-benchmark ( -- )
2000 <cuckoo-filter> insert-data test-hit test-miss drop ;
MAIN: cuckoo-filters-benchmark