]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/benchmark/hashtables/hashtables.factor
factor: trim using lists
[factor.git] / extra / benchmark / hashtables / hashtables.factor
index 065ad9c34a4202ad7e05cead99059ebccdf14d86..b29cb3d43d3e8a9686b623842a64bd8c23d0904f 100644 (file)
@@ -1,12 +1,11 @@
 ! 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 ;
+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 |
@@ -32,7 +31,7 @@ MEMO: strings ( -- str )
     ] map drop
 
     keys [
-        hash [ 1 + ] change-at
+        hash [ 1 + ] assocs:change-at
     ] each ;
 
 : string-mix ( hash -- )
@@ -58,7 +57,7 @@ M: collision hashcode* value>> hashcode* 15 bitand ;
         2bi
     ] with each ;
 
-: hashtable-benchmark ( -- )
+: hashtables-benchmark ( -- )
     H{ } clone
     10000 [
         dup {
@@ -72,4 +71,4 @@ M: collision hashcode* value>> hashcode* 15 bitand ;
     ] times
     drop ;
 
-MAIN: hashtable-benchmark
\ No newline at end of file
+MAIN: hashtables-benchmark