Fix dawes benchmark

db4
Slava Pestov 2008-12-03 06:21:02 -06:00
parent e9abdef5c5
commit 9e9b2e389e
1 changed files with 4 additions and 4 deletions

View File

@ -1,16 +1,16 @@
USING: sequences hints kernel math specialized-arrays.int ;
USING: sequences hints kernel math specialized-arrays.int fry ;
IN: benchmark.dawes
! Phil Dawes's performance problem
: count-ones ( byte-array -- n ) [ 1 = ] sigma ;
: count-ones ( int-array -- n ) [ 1 = ] count ; inline
HINTS: count-ones int-array ;
: make-byte-array ( -- byte-array )
: make-int-array ( -- int-array )
120000 [ 255 bitand ] int-array{ } map-as ;
: dawes-benchmark ( -- )
make-byte-array 200 swap [ count-ones ] curry replicate drop ;
make-int-array 200 swap '[ _ count-ones ] replicate drop ;
MAIN: dawes-benchmark