! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs combinators kernel locals math
-math.ranges memoize sequences strings hashtables
-math.parser grouping ;
-FROM: assocs => change-at ;
+USING: accessors assocs combinators grouping kernel math
+math.parser ranges sequences ;
IN: benchmark.hashtables
MEMO: strings ( -- str )
- 1 100 [a,b] 1 [ + ] accumulate nip [ number>string ] map ;
+ 100 [0..b) 1 [ + ] accumulate* [ number>string ] map ;
:: add-delete-mix ( hash keys -- )
keys [| k |
] map drop
keys [
- hash [ 1 + ] change-at
+ hash [ 1 + ] assocs:change-at
] each ;
: string-mix ( hash -- )
2bi
] with each ;
-: hashtable-benchmark ( -- )
+: hashtables-benchmark ( -- )
H{ } clone
10000 [
dup {
] times
drop ;
-MAIN: hashtable-benchmark
+MAIN: hashtables-benchmark