1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs combinators grouping kernel locals math
4 math.parser math.ranges memoize sequences ;
5 IN: benchmark.hashtables
7 MEMO: strings ( -- str )
8 0 100 [a,b) 1 [ + ] accumulate* [ number>string ] map ;
10 :: add-delete-mix ( hash keys -- )
24 :: store-lookup-mix ( hash keys -- )
34 hash [ 1 + ] assocs:change-at
37 : string-mix ( hash -- )
43 TUPLE: collision value ;
45 M: collision hashcode* value>> hashcode* 15 bitand ;
47 : collision-mix ( hash -- )
48 strings 30 head [ collision boa ] map
53 : small-mix ( hash -- )
60 : hashtables-benchmark ( -- )
74 MAIN: hashtables-benchmark