]> gitweb.factorcode.org Git - factor.git/blob - extra/benchmark/dispatch2/dispatch2.factor
Fixing everything for mandatory stack effects
[factor.git] / extra / benchmark / dispatch2 / dispatch2.factor
1 USING: namespaces math sequences splitting kernel columns ;
2 IN: benchmark.dispatch2
3
4 : sequences ( -- seq )
5     [
6         1 ,
7         10 >bignum ,
8         { 1 2 3 } ,
9         "hello world" ,
10         SBUF" sbuf world" ,
11         V{ "a" "b" "c" } ,
12         F{ 1.0 2.0 3.0 } ,
13         "hello world" 4 tail-slice ,
14         10 f <repetition> ,
15         100 2 <sliced-groups> ,
16         "hello" <reversed> ,
17         { { 1 2 } { 3 4 } } 0 <column> ,
18         ?{ t f t } ,
19         B{ 1 2 3 } ,
20         [ "a" "b" "c" ] ,
21         1 [ + ] curry ,
22     ] { } make ;
23
24 : don't-flush-me ( obj -- ) drop ;
25
26 : dispatch-test ( -- )
27     1000000 sequences
28     [ [ 0 swap nth don't-flush-me ] each ] curry times ;
29
30 MAIN: dispatch-test