factor/library/test/benchmark/hashtables.factor

18 lines
445 B
Factor
Raw Normal View History

2005-11-24 19:02:20 -05:00
IN: temporary
USING: compiler hashtables kernel math memory namespaces
sequences strings test ;
2004-10-27 21:21:31 -04:00
2005-11-24 19:02:20 -05:00
: store-hash ( hashtable seq -- )
2005-09-24 23:21:09 -04:00
[ dup pick set-hash ] each drop ;
2004-10-27 21:21:31 -04:00
2005-11-24 19:02:20 -05:00
: lookup-hash ( hashtable seq -- )
2005-09-24 23:21:09 -04:00
[ over hash drop ] each drop ;
2004-10-27 21:21:31 -04:00
2005-11-24 19:02:20 -05:00
: hashtable-benchmark ( seq -- )
100 [
2005-09-24 23:21:09 -04:00
drop
2005-11-24 19:02:20 -05:00
100000 <hashtable> swap 2dup store-hash lookup-hash
] each-with ; compiled
2004-10-27 21:21:31 -04:00
2005-11-24 19:02:20 -05:00
[ ] [ [ string? ] instances hashtable-benchmark ] unit-test