factor/apps/benchmarks/empty-loop.factor

20 lines
450 B
Factor
Raw Normal View History

IN: temporary
USING: compiler kernel math math-internals sequences test ;
: empty-loop-0 ( n -- )
dup 0 fixnum< [ drop ] [ 1 fixnum-fast empty-loop-0 ] if ;
2004-08-23 23:27:55 -04:00
2004-10-27 21:21:31 -04:00
: empty-loop-1 ( n -- )
[ ] times ;
2004-10-27 21:21:31 -04:00
: empty-loop-2 ( n -- )
[ ] repeat ;
2004-10-27 21:21:31 -04:00
2005-07-31 23:38:33 -04:00
: empty-loop-3 ( n -- )
[ drop ] each ;
2005-07-31 23:38:33 -04:00
[ ] [ 5000000 empty-loop-0 ] unit-test
2004-10-27 21:21:31 -04:00
[ ] [ 5000000 empty-loop-1 ] unit-test
[ ] [ 5000000 empty-loop-2 ] unit-test
2005-07-31 23:38:33 -04:00
[ ] [ 5000000 empty-loop-3 ] unit-test