2004-10-27 21:21:31 -04:00
|
|
|
USE: strings
|
2004-12-10 19:29:07 -05:00
|
|
|
USE: kernel
|
2004-10-27 21:21:31 -04:00
|
|
|
USE: math
|
|
|
|
USE: test
|
|
|
|
USE: unparser
|
|
|
|
USE: hashtables
|
2004-12-17 19:27:42 -05:00
|
|
|
USE: compiler
|
2004-10-27 21:21:31 -04:00
|
|
|
|
|
|
|
! http://inferno.bell-labs.com/cm/cs/who/bwk/interps/pap.html
|
|
|
|
|
|
|
|
: store-hash ( hashtable n -- )
|
2005-01-23 16:47:28 -05:00
|
|
|
[ [ dup >hex swap pick set-hash ] keep ] repeat drop ; compiled
|
2004-10-27 21:21:31 -04:00
|
|
|
|
|
|
|
: lookup-hash ( hashtable n -- )
|
2005-01-23 16:47:28 -05:00
|
|
|
[ [ unparse over hash drop ] keep ] repeat drop ; compiled
|
2004-10-27 21:21:31 -04:00
|
|
|
|
|
|
|
: hashtable-benchmark ( n -- )
|
2004-12-17 19:27:42 -05:00
|
|
|
60000 <hashtable> swap 2dup store-hash lookup-hash ; compiled
|
2004-10-27 21:21:31 -04:00
|
|
|
|
|
|
|
[ ] [ 80000 hashtable-benchmark ] unit-test
|