benchmark.hash-sets: adding a benchmark for hash-sets.

db4
John Benediktsson 2012-04-16 10:57:57 -07:00
parent cdd4de2cb3
commit 0c16b7cc1a
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
USING: combinators hash-sets kernel math.combinatorics sequences sets ;
IN: benchmark.hash-sets
: make-sets ( -- seq )
{ 10 100 1,000 10,000 100,000 1,000000 } [ iota >hash-set ] map ;
: bench-sets ( seq -- )
2 [
first2 {
[ union drop ]
[ intersect drop ]
[ intersects? drop ]
[ diff drop ]
[ set= drop ]
[ subset? drop ]
} 2cleave
] each-combination ;
: hash-sets-benchmark ( -- )
make-sets bench-sets ;
MAIN: hash-sets-benchmark