1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs combinators kernel locals math
4 math.ranges memoize sequences strings hashtables
7 IN: benchmark.hashtables
9 MEMO: strings ( -- str )
10 0 100 [a,b) 1 [ + ] accumulate* [ number>string ] map ;
12 :: add-delete-mix ( hash keys -- )
26 :: store-lookup-mix ( hash keys -- )
36 hash [ 1 + ] assocs:change-at
39 : string-mix ( hash -- )
45 TUPLE: collision value ;
47 M: collision hashcode* value>> hashcode* 15 bitand ;
49 : collision-mix ( hash -- )
50 strings 30 head [ collision boa ] map
55 : small-mix ( hash -- )
62 : hashtables-benchmark ( -- )
76 MAIN: hashtables-benchmark