]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/dispatch2/dispatch2.factor
factor: trim using lists
[factor.git] / extra / benchmark / dispatch2 / dispatch2.factor
1 USING: alien.c-types make math sequences grouping
2 kernel columns specialized-arrays bit-arrays ;
3 SPECIALIZED-ARRAY: double
4 IN: benchmark.dispatch2
5
6 : sequences ( -- seq )
7     [
8         1 <iota> ,
9         10 >bignum <iota> ,
10         { 1 2 3 } ,
11         "hello world" ,
12         SBUF" sbuf world" ,
13         V{ "a" "b" "c" } ,
14         double-array{ 1.0 2.0 3.0 } ,
15         "hello world" 4 tail-slice ,
16         10 f <repetition> ,
17         100 <iota> 2 <groups> ,
18         "hello" <reversed> ,
19         { { 1 2 } { 3 4 } } 0 <column> ,
20         ?{ t f t } ,
21         B{ 1 2 3 } ,
22         [ "a" "b" "c" ] ,
23         1 [ + ] curry ,
24     ] { } make ;
25
26 : don't-flush-me ( obj -- ) drop ;
27
28 : dispatch2-benchmark ( -- )
29     1000000 sequences
30     [ [ first don't-flush-me ] each ] curry times ;
31
32 MAIN: dispatch2-benchmark