factor/library/test/benchmark/hashtables.factor

15 lines
399 B
Factor
Raw Normal View History

USING: compiler hashtables kernel math namespaces test ;
2004-10-27 21:21:31 -04:00
: store-hash ( hashtable n -- )
[ [ >float dup pick set-hash ] keep ] repeat drop ;
2004-10-27 21:21:31 -04:00
: lookup-hash ( hashtable n -- )
[ [ >float over hash drop ] keep ] repeat drop ;
2004-10-27 21:21:31 -04:00
: hashtable-benchmark ( -- )
100 [
80000 1000 <hashtable> swap 2dup store-hash lookup-hash
] times ; compiled
2004-10-27 21:21:31 -04:00
[ ] [ hashtable-benchmark ] unit-test