]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/benchmark/dispatch2/dispatch2.factor
factor: trim using lists
[factor.git] / extra / benchmark / dispatch2 / dispatch2.factor
index 7145cd94f7a60facef902fe6fae943a4daa37d9d..a30719359be84ca99b17dcfb7e10d036d902e69c 100644 (file)
@@ -1,19 +1,20 @@
-USING: namespaces math sequences splitting grouping
-kernel columns float-arrays bit-arrays ;
+USING: alien.c-types make math sequences grouping
+kernel columns specialized-arrays bit-arrays ;
+SPECIALIZED-ARRAY: double
 IN: benchmark.dispatch2
 
 : sequences ( -- seq )
     [
-        1 ,
-        10 >bignum ,
+        1 <iota> ,
+        10 >bignum <iota> ,
         { 1 2 3 } ,
         "hello world" ,
         SBUF" sbuf world" ,
         V{ "a" "b" "c" } ,
-        F{ 1.0 2.0 3.0 } ,
+        double-array{ 1.0 2.0 3.0 } ,
         "hello world" 4 tail-slice ,
         10 f <repetition> ,
-        100 2 <sliced-groups> ,
+        100 <iota> 2 <groups> ,
         "hello" <reversed> ,
         { { 1 2 } { 3 4 } } 0 <column> ,
         ?{ t f t } ,
@@ -24,8 +25,8 @@ IN: benchmark.dispatch2
 
 : don't-flush-me ( obj -- ) drop ;
 
-: dispatch-test ( -- )
+: dispatch2-benchmark ( -- )
     1000000 sequences
-    [ [ 0 swap nth don't-flush-me ] each ] curry times ;
+    [ [ first don't-flush-me ] each ] curry times ;
 
-MAIN: dispatch-test
\ No newline at end of file
+MAIN: dispatch2-benchmark