2013-03-27 19:12:08 -04:00
|
|
|
USING: kernel math sequences splitting ;
|
|
|
|
IN: benchmark.splitting
|
|
|
|
|
2013-04-01 13:26:43 -04:00
|
|
|
: test-data ( -- seq seps )
|
2017-06-01 17:59:35 -04:00
|
|
|
1000 <iota> dup [ 10 /i zero? ] filter ; ! not inline to prevent type inference
|
2013-03-27 19:12:08 -04:00
|
|
|
|
|
|
|
: splitting-benchmark ( -- )
|
2013-04-01 13:26:43 -04:00
|
|
|
test-data 2,000 [
|
2013-03-27 19:12:08 -04:00
|
|
|
over [ even? ] split-when-slice drop
|
2013-04-01 13:26:43 -04:00
|
|
|
2dup split-slice drop
|
2013-03-27 19:12:08 -04:00
|
|
|
] times 2drop ;
|
|
|
|
|
|
|
|
MAIN: splitting-benchmark
|