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
6 IN: benchmark.hashtables
8 MEMO: strings ( -- str )
9 1 100 [a,b] 1 [ + ] accumulate nip [ number>string ] map ;
11 :: add-delete-mix ( hash keys -- )
25 :: store-lookup-mix ( hash keys -- )
35 hash [ 1 + ] change-at
38 : string-mix ( hash -- )
44 TUPLE: collision value ;
46 M: collision hashcode* value>> hashcode* 15 bitand ;
48 : collision-mix ( hash -- )
49 strings 30 head [ collision boa ] map
54 : small-mix ( hash -- )
61 : hashtable-benchmark ( -- )
75 MAIN: hashtable-benchmark