benchmark: rename main methods to be consistent.

db4
John Benediktsson 2012-07-19 17:35:47 -07:00
parent d9da6e4781
commit 2e86fd6af0
71 changed files with 150 additions and 148 deletions

View File

@ -11,7 +11,7 @@ IN: benchmark.3d-matrix-scalar
{ 0.0 1.0 0.0 } yaw rotation-matrix4 { 0.0 1.0 0.0 } yaw rotation-matrix4
location vneg translation-matrix4 m. m. ; location vneg translation-matrix4 m. m. ;
:: 3d-matrix ( -- ) :: 3d-matrix-scalar-benchmark ( -- )
f :> result! f :> result!
100000 [ 100000 [
{ 1024.0 768.0 } 0.7 0.25 1024.0 p-matrix :> p { 1024.0 768.0 } 0.7 0.25 1024.0 p-matrix :> p
@ -20,4 +20,4 @@ IN: benchmark.3d-matrix-scalar
] times ] times
result . ; result . ;
MAIN: 3d-matrix MAIN: 3d-matrix-scalar-benchmark

View File

@ -15,7 +15,7 @@ TYPED:: mv-matrix ( pitch: float yaw: float location: float-4 -- matrix: matrix4
float-4{ 0.0 1.0 0.0 0.0 } yaw rotation-matrix4 float-4{ 0.0 1.0 0.0 0.0 } yaw rotation-matrix4
location vneg translation-matrix4 m4. m4. ; location vneg translation-matrix4 m4. m4. ;
:: 3d-matrix ( -- ) :: 3d-matrix-vector-benchmark ( -- )
f :> result! f :> result!
100000 [ 100000 [
float-4{ 1024.0 768.0 0.0 0.0 } 0.7 0.25 1024.0 p-matrix :> p float-4{ 1024.0 768.0 0.0 0.0 } 0.7 0.25 1024.0 p-matrix :> p
@ -24,4 +24,4 @@ TYPED:: mv-matrix ( pitch: float yaw: float location: float-4 -- matrix: matrix4
] times ] times
result . ; result . ;
MAIN: 3d-matrix MAIN: 3d-matrix-vector-benchmark

View File

@ -7,8 +7,8 @@ IN: benchmark.beust1
: count-numbers ( max -- n ) : count-numbers ( max -- n )
1 [a,b] [ number>string all-unique? ] count ; inline 1 [a,b] [ number>string all-unique? ] count ; inline
: beust ( -- ) : beust1-benchmark ( -- )
2000000 count-numbers 2000000 count-numbers
number>string " unique numbers." append print ; number>string " unique numbers." append print ;
MAIN: beust MAIN: beust1-benchmark

View File

@ -31,9 +31,9 @@ IN: benchmark.beust2
10 iota [ 1 + 1 1 0 max listener (count-numbers) ] any? drop ; 10 iota [ 1 + 1 1 0 max listener (count-numbers) ] any? drop ;
inline inline
:: beust ( -- ) :: beust2-benchmark ( -- )
0 :> i! 0 :> i!
5000000000 [ i 1 + i! ] count-numbers 5000000000 [ i 1 + i! ] count-numbers
i number>string " unique numbers." append print ; i number>string " unique numbers." append print ;
MAIN: beust MAIN: beust2-benchmark

View File

@ -53,7 +53,7 @@ CONSTANT: min-depth 4
: binary-trees ( n -- ) : binary-trees ( n -- )
min-depth 2 + max [ stretch-tree ] [ long-lived-tree ] bi ; inline min-depth 2 + max [ stretch-tree ] [ long-lived-tree ] bi ; inline
: binary-trees-main ( -- ) : binary-trees-benchmark ( -- )
16 binary-trees ; 16 binary-trees ;
MAIN: binary-trees-main MAIN: binary-trees-benchmark

View File

@ -95,7 +95,7 @@ TUPLE: meeting-place count mailbox ;
! 6000000 for shootout, too slow right now ! 6000000 for shootout, too slow right now
: chameneos-redux-main ( -- ) : chameneos-redux-benchmark ( -- )
print-color-table print-color-table
60000 [ 60000 [
{ blue red yellow } chameneos-redux { blue red yellow } chameneos-redux
@ -103,4 +103,4 @@ TUPLE: meeting-place count mailbox ;
{ blue red yellow red yellow blue red yellow red blue } chameneos-redux { blue red yellow red yellow blue red yellow red blue } chameneos-redux
] bi ; ] bi ;
MAIN: chameneos-redux-main MAIN: chameneos-redux-benchmark

View File

@ -1,7 +1,7 @@
USING: math kernel continuations ; USING: math kernel continuations ;
IN: benchmark.continuations IN: benchmark.continuations
: continuations-main ( -- ) : continuations-benchmark ( -- )
100000 [ drop [ continue ] callcc0 ] each-integer ; 100000 [ drop [ continue ] callcc0 ] each-integer ;
MAIN: continuations-main MAIN: continuations-benchmark

View File

@ -1,10 +1,10 @@
USING: checksums checksums.crc32 io.encodings.ascii io.files kernel math ; USING: checksums checksums.crc32 io.encodings.ascii io.files kernel math ;
IN: benchmark.crc32 IN: benchmark.crc32
: crc32-file ( -- ) : crc32-benchmark ( -- )
10 [ 10 [
"vocab:mime/multipart/multipart-tests.factor" "vocab:mime/multipart/multipart-tests.factor"
crc32 checksum-file drop crc32 checksum-file drop
] times ; ] times ;
MAIN: crc32-file MAIN: crc32-benchmark

View File

@ -70,8 +70,8 @@ M: x30 g ;
: a-bunch-of-objects ( -- seq ) : a-bunch-of-objects ( -- seq )
my-classes [ new ] map ; my-classes [ new ] map ;
: dispatch-benchmark ( -- ) : dispatch1-benchmark ( -- )
1000000 a-bunch-of-objects 1000000 a-bunch-of-objects
[ [ g drop ] each ] curry times ; [ [ g drop ] each ] curry times ;
MAIN: dispatch-benchmark MAIN: dispatch1-benchmark

View File

@ -25,8 +25,8 @@ IN: benchmark.dispatch2
: don't-flush-me ( obj -- ) drop ; : don't-flush-me ( obj -- ) drop ;
: dispatch-test ( -- ) : dispatch2-benchmark ( -- )
1000000 sequences 1000000 sequences
[ [ first don't-flush-me ] each ] curry times ; [ [ first don't-flush-me ] each ] curry times ;
MAIN: dispatch-test MAIN: dispatch2-benchmark

View File

@ -44,7 +44,7 @@ M: object g drop "object" ;
ALIEN: 1234 , ALIEN: 1234 ,
] { } make ; ] { } make ;
: dispatch-test ( -- ) : dispatch3-benchmark ( -- )
2000000 objects [ [ g drop ] each ] curry times ; 2000000 objects [ [ g drop ] each ] curry times ;
MAIN: dispatch-test MAIN: dispatch3-benchmark

View File

@ -50,7 +50,7 @@ IN: benchmark.dispatch4
{ [ dup 19 eq? ] [ drop 19 ] } { [ dup 19 eq? ] [ drop 19 ] }
} cond ; } cond ;
: foobar-test-1 ( -- ) : dispatch4-benchmark ( -- )
20000000 [ 20000000 [
20 [ 20 [
foobar-1 drop foobar-1 drop
@ -64,4 +64,4 @@ IN: benchmark.dispatch4
] each-integer ] each-integer
] times ; ] times ;
MAIN: foobar-test-1 MAIN: dispatch4-benchmark

View File

@ -70,8 +70,8 @@ INSTANCE: x30 g
: a-bunch-of-objects ( -- seq ) : a-bunch-of-objects ( -- seq )
my-classes [ new ] map ; my-classes [ new ] map ;
: dispatch-benchmark ( -- ) : dispatch5-benchmark ( -- )
1000000 a-bunch-of-objects 1000000 a-bunch-of-objects
[ f [ g? or ] reduce drop ] curry times ; [ f [ g? or ] reduce drop ] curry times ;
MAIN: dispatch-benchmark MAIN: dispatch5-benchmark

View File

@ -11,7 +11,7 @@ IN: benchmark.e-decimals
n [1,b] D: 1 n [1,b] D: 1
[ D-factorial D: 1 swap n D/ D+ ] reduce ; [ D-factorial D: 1 swap n D/ D+ ] reduce ;
: calculate-e-decimals-benchmark ( -- ) : e-decimals-benchmark ( -- )
5 [ 800 calculate-e-decimals drop ] times ; 5 [ 800 calculate-e-decimals drop ] times ;
MAIN: calculate-e-decimals-benchmark MAIN: e-decimals-benchmark

View File

@ -6,7 +6,7 @@ IN: benchmark.e-ratios
: calculate-e-ratios ( n -- e ) : calculate-e-ratios ( n -- e )
iota [ factorial recip ] map-sum ; iota [ factorial recip ] map-sum ;
: calculate-e-ratios-benchmark ( -- ) : e-ratios-benchmark ( -- )
5 [ 300 calculate-e-ratios drop ] times ; 5 [ 300 calculate-e-ratios drop ] times ;
MAIN: calculate-e-ratios-benchmark MAIN: e-ratios-benchmark

View File

@ -4,7 +4,7 @@ IN: benchmark.empty-loop-0
: empty-loop-0 ( n -- ) : empty-loop-0 ( n -- )
dup 0 fixnum< [ drop ] [ 1 fixnum-fast empty-loop-0 ] if ; dup 0 fixnum< [ drop ] [ 1 fixnum-fast empty-loop-0 ] if ;
: empty-loop-main ( -- ) : empty-loop-0-benchmark ( -- )
50000000 empty-loop-0 ; 50000000 empty-loop-0 ;
MAIN: empty-loop-main MAIN: empty-loop-0-benchmark

View File

@ -4,7 +4,7 @@ IN: benchmark.empty-loop-1
: empty-loop-1 ( n -- ) : empty-loop-1 ( n -- )
[ drop ] each-integer ; [ drop ] each-integer ;
: empty-loop-main ( -- ) : empty-loop-1-benchmark ( -- )
50000000 empty-loop-1 ; 50000000 empty-loop-1 ;
MAIN: empty-loop-main MAIN: empty-loop-1-benchmark

View File

@ -4,7 +4,7 @@ IN: benchmark.empty-loop-2
: empty-loop-2 ( n -- ) : empty-loop-2 ( n -- )
iota [ drop ] each ; iota [ drop ] each ;
: empty-loop-main ( -- ) : empty-loop-2-benchmark ( -- )
50000000 empty-loop-2 ; 50000000 empty-loop-2 ;
MAIN: empty-loop-main MAIN: empty-loop-2-benchmark

View File

@ -29,7 +29,7 @@ IN: benchmark.fannkuch
] keep ] keep
"Pfannkuchen(" write pprint ") = " write . ; "Pfannkuchen(" write pprint ") = " write . ;
: fannkuch-main ( -- ) : fannkuch-benchmark ( -- )
9 fannkuch ; 9 fannkuch ;
MAIN: fannkuch-main MAIN: fannkuch-benchmark

View File

@ -102,6 +102,6 @@ TYPED:: make-repeat-fasta ( k: fixnum len: fixnum alu: string -- k': fixnum )
] with-file-writer ] with-file-writer
] ; ] ;
: run-fasta ( -- ) 2500000 reverse-complement-in fasta ; : fasta-benchmark ( -- ) 2500000 reverse-complement-in fasta ;
MAIN: run-fasta MAIN: fasta-benchmark

View File

@ -4,6 +4,7 @@ USING: arrays kernel math ;
IN: benchmark.gc0 IN: benchmark.gc0
: allocate ( -- obj ) 10 f <array> ; : allocate ( -- obj ) 10 f <array> ;
: gc0 ( -- ) f 60000000 [ allocate nip ] times drop ;
MAIN: gc0 : gc0-benchmark ( -- ) f 60000000 [ allocate nip ] times drop ;
MAIN: gc0-benchmark

View File

@ -3,6 +3,6 @@
USING: math sequences kernel ; USING: math sequences kernel ;
IN: benchmark.gc1 IN: benchmark.gc1
: gc1 ( -- ) 600000 iota [ >bignum 1 + ] map drop ; : gc1-benchmark ( -- ) 600000 iota [ >bignum 1 + ] map drop ;
MAIN: gc1 MAIN: gc1-benchmark

View File

@ -15,10 +15,10 @@ SYMBOL: oldies
: age ( -- ) : age ( -- )
1000 [ allocate drop ] times ; 1000 [ allocate drop ] times ;
: gc2 ( -- ) : gc2-benchmark ( -- )
[ [
make-old-objects make-old-objects
50000 [ age ] times 50000 [ age ] times
] with-scope ; ] with-scope ;
MAIN: gc2 MAIN: gc2-benchmark

View File

@ -3,9 +3,9 @@
USING: math.parser fry sequences kernel assocs hashtables ; USING: math.parser fry sequences kernel assocs hashtables ;
IN: benchmark.gc3 IN: benchmark.gc3
: gc3 ( -- ) : gc3-benchmark ( -- )
1000000 iota 1000000 iota
1000000 <hashtable> 1000000 <hashtable>
'[ [ number>string ] keep _ set-at ] each ; '[ [ number>string ] keep _ set-at ] each ;
MAIN: gc3 MAIN: gc3-benchmark

View File

@ -59,7 +59,7 @@ M: collision hashcode* value>> hashcode* 15 bitand ;
2bi 2bi
] with each ; ] with each ;
: hashtable-benchmark ( -- ) : hashtables-benchmark ( -- )
H{ } clone H{ } clone
10000 [ 10000 [
dup { dup {
@ -73,4 +73,4 @@ M: collision hashcode* value>> hashcode* 15 bitand ;
] times ] times
drop ; drop ;
MAIN: hashtable-benchmark MAIN: hashtables-benchmark

View File

@ -13,7 +13,7 @@ IN: benchmark.heaps
[ length [ dup heap-pop* ] times ] bi [ length [ dup heap-pop* ] times ] bi
drop ; drop ;
: heap-benchmark ( -- ) : heaps-benchmark ( -- )
100 [ heap-test ] times ; 100 [ heap-test ] times ;
MAIN: heap-benchmark MAIN: heaps-benchmark

View File

@ -11,11 +11,11 @@ kernel ;
: reverse-iter ( -- ) 100 [ 0 100000 <range> >vector <reversed> [ ] map drop ] times ; : reverse-iter ( -- ) 100 [ 0 100000 <range> >vector <reversed> [ ] map drop ] times ;
: dot-iter ( -- ) 100 [ 0 100000 <range> dup v. drop ] times ; : dot-iter ( -- ) 100 [ 0 100000 <range> dup v. drop ] times ;
: iter-main ( -- ) : iteration-benchmark ( -- )
vector-iter vector-iter
array-iter array-iter
string-iter string-iter
sbuf-iter sbuf-iter
reverse-iter ; reverse-iter ;
MAIN: iter-main MAIN: iteration-benchmark

View File

@ -3,8 +3,8 @@
USING: io.encodings.utf8 io.files kernel peg.javascript ; USING: io.encodings.utf8 io.files kernel peg.javascript ;
IN: benchmark.javascript IN: benchmark.javascript
: javascript-parser-benchmark ( -- ) : javascript-benchmark ( -- )
"vocab:benchmark/javascript/jquery-1.3.2.min.js" "vocab:benchmark/javascript/jquery-1.3.2.min.js"
utf8 file-contents parse-javascript drop ; utf8 file-contents parse-javascript drop ;
MAIN: javascript-parser-benchmark MAIN: javascript-benchmark

View File

@ -37,9 +37,9 @@ CONSTANT: knucleotide-in "vocab:benchmark/knucleotide/knucleotide-input.txt"
] ]
tri ; tri ;
: knucleotide ( -- ) : knucleotide-benchmark ( -- )
knucleotide-in knucleotide-in
ascii [ read-input ] with-file-reader ascii [ read-input ] with-file-reader
process-input ; process-input ;
MAIN: knucleotide MAIN: knucleotide-benchmark

View File

@ -31,7 +31,7 @@ IN: benchmark.mandel
"P6\n" write width pprint " " write height pprint "\n255\n" write "P6\n" write width pprint " " write height pprint "\n255\n" write
binary encode-output ; inline binary encode-output ; inline
: mandel-main ( -- ) : mandel-benchmark ( -- )
"mandel.ppm" temp-file binary [ ppm-header render ] with-file-writer ; "mandel.ppm" temp-file binary [ ppm-header render ] with-file-writer ;
MAIN: mandel-main MAIN: mandel-benchmark

View File

@ -13,7 +13,7 @@ IN: benchmark.matrix-exponential-scalar
m i m^n i factorial >float m/n m+ m i m^n i factorial >float m/n m+
] each ; ] each ;
:: matrix-e ( -- ) :: matrix-exponential-scalar-benchmark ( -- )
f :> result! f :> result!
4 identity-matrix :> i4 4 identity-matrix :> i4
10000 [ 10000 [
@ -21,4 +21,4 @@ IN: benchmark.matrix-exponential-scalar
] times ] times
result . ; result . ;
MAIN: matrix-e MAIN: matrix-exponential-scalar-benchmark

View File

@ -8,11 +8,11 @@ TYPED:: e^m4 ( m: matrix4 iterations: fixnum -- e^m: matrix4 )
m i m4^n i factorial >float m4/n m4+ m i m4^n i factorial >float m4/n m4+
] each ; ] each ;
:: matrix-e ( -- ) :: matrix-exponential-simd-benchmark ( -- )
f :> result! f :> result!
10000 [ 10000 [
identity-matrix4 20 e^m4 result! identity-matrix4 20 e^m4 result!
] times ] times
result . ; result . ;
MAIN: matrix-e MAIN: matrix-exponential-simd-benchmark

View File

@ -1,7 +1,7 @@
USING: checksums checksums.md5 sequences byte-arrays kernel ; USING: checksums checksums.md5 sequences byte-arrays kernel ;
IN: benchmark.md5 IN: benchmark.md5
: md5-file ( -- ) : md5-benchmark ( -- )
2000000 iota >byte-array md5 checksum-bytes drop ; 2000000 iota >byte-array md5 checksum-bytes drop ;
MAIN: md5-file MAIN: md5-benchmark

View File

@ -3,9 +3,9 @@
USING: fry kernel math random random.mersenne-twister ; USING: fry kernel math random random.mersenne-twister ;
IN: benchmark.mt IN: benchmark.mt
: mt-benchmark ( n -- ) : mt-bench ( n -- )
>fixnum 0x533d <mersenne-twister> '[ _ random-32* drop ] times ; >fixnum 0x533d <mersenne-twister> '[ _ random-32* drop ] times ;
: mt-main ( -- ) 10000000 mt-benchmark ; : mt-benchmark ( -- ) 10000000 mt-bench ;
MAIN: mt-main MAIN: mt-benchmark

View File

@ -98,6 +98,6 @@ SPECIALIZED-ARRAY: body
[ '[ _ 0.01 advance ] times ] [ '[ _ 0.01 advance ] times ]
[ energy number>string print ] tri ; [ energy number>string print ] tri ;
: nbody-main ( -- ) 1000000 nbody ; : nbody-simd-benchmark ( -- ) 1000000 nbody ;
MAIN: nbody-main MAIN: nbody-simd-benchmark

View File

@ -102,6 +102,6 @@ HINTS: inertia body ;
HINTS: newton's-law body body ; HINTS: newton's-law body body ;
HINTS: nbody fixnum ; HINTS: nbody fixnum ;
: nbody-main ( -- ) 1000000 nbody ; : nbody-benchmark ( -- ) 1000000 nbody ;
MAIN: nbody-main MAIN: nbody-benchmark

View File

@ -24,6 +24,6 @@ IN: benchmark.nested-empty-loop-1
HINTS: nested-empty-loop fixnum ; HINTS: nested-empty-loop fixnum ;
: nested-empty-loop-main ( -- ) 7 nested-empty-loop ; : nested-empty-loop-1-benchmark ( -- ) 7 nested-empty-loop ;
MAIN: nested-empty-loop-main MAIN: nested-empty-loop-1-benchmark

View File

@ -26,6 +26,6 @@ IN: benchmark.nested-empty-loop-2
HINTS: nested-empty-loop fixnum ; HINTS: nested-empty-loop fixnum ;
: nested-empty-loop-main ( -- ) 7 nested-empty-loop ; : nested-empty-loop-2-benchmark ( -- ) 7 nested-empty-loop ;
MAIN: nested-empty-loop-main MAIN: nested-empty-loop-2-benchmark

View File

@ -32,6 +32,6 @@ IN: benchmark.nsieve-bits
[ 2 - 2^ 10000 * nsieve-bits. ] [ 2 - 2^ 10000 * nsieve-bits. ]
tri ; tri ;
: nsieve-bits-main* ( -- ) 11 nsieve-bits-main ; : nsieve-bits-benchmark ( -- ) 11 nsieve-bits-main ;
MAIN: nsieve-bits-main* MAIN: nsieve-bits-benchmark

View File

@ -30,6 +30,6 @@ byte-arrays make io ;
dup 1 - 2^ 10000 * nsieve. dup 1 - 2^ 10000 * nsieve.
2 - 2^ 10000 * nsieve. ; 2 - 2^ 10000 * nsieve. ;
: nsieve-main* ( -- ) 9 nsieve-main ; : nsieve-bytes-benchmark ( -- ) 9 nsieve-main ;
MAIN: nsieve-main* MAIN: nsieve-bytes-benchmark

View File

@ -31,6 +31,6 @@ IN: benchmark.nsieve
[ 2 - 2^ 10000 * nsieve. ] [ 2 - 2^ 10000 * nsieve. ]
tri ; tri ;
: nsieve-main* ( -- ) 9 nsieve-main ; : nsieve-benchmark ( -- ) 9 nsieve-main ;
MAIN: nsieve-main* MAIN: nsieve-benchmark

View File

@ -38,7 +38,7 @@ IN: benchmark.partial-sums
HINTS: partial-sums fixnum ; HINTS: partial-sums fixnum ;
: partial-sums-main ( -- ) : partial-sums-benchmark ( -- )
2500000 partial-sums simple-table. ; 2500000 partial-sums simple-table. ;
MAIN: partial-sums-main MAIN: partial-sums-benchmark

View File

@ -53,7 +53,7 @@ IN: benchmark.pidigits
: pidigits ( n -- ) : pidigits ( n -- )
[ 1 { { 1 0 } { 0 1 } } ] dip 0 0 (pidigits) ; [ 1 { { 1 0 } { 0 1 } } ] dip 0 0 (pidigits) ;
: pidigits-main ( -- ) : pidigits-benchmark ( -- )
2000 pidigits ; 2000 pidigits ;
MAIN: pidigits-main MAIN: pidigits-benchmark

View File

@ -10,7 +10,7 @@ IN: benchmark.random
[ 200 random 100 - number>string print ] times [ 200 random 100 - number>string print ] times
] with-file-writer ; ] with-file-writer ;
: random-main ( -- ) : random-benchmark ( -- )
300000 write-random-numbers ; 300000 write-random-numbers ;
MAIN: random-main MAIN: random-benchmark

View File

@ -167,7 +167,7 @@ CONSTANT: create-offsets
[ [ oversampling sq / pgm-pixel ] each ] each [ [ oversampling sq / pgm-pixel ] each ] each
] B{ } make ; ] B{ } make ;
: raytracer-main ( -- ) : raytracer-simd-benchmark ( -- )
run "raytracer.pnm" temp-file binary set-file-contents ; run "raytracer.pnm" temp-file binary set-file-contents ;
MAIN: raytracer-main MAIN: raytracer-simd-benchmark

View File

@ -181,7 +181,7 @@ DEFER: create
[ [ oversampling sq / pgm-pixel ] each ] each [ [ oversampling sq / pgm-pixel ] each ] each
] B{ } make ; ] B{ } make ;
: raytracer-main ( -- ) : raytracer-benchmark ( -- )
run "raytracer.pnm" temp-file binary set-file-contents ; run "raytracer.pnm" temp-file binary set-file-contents ;
MAIN: raytracer-main MAIN: raytracer-benchmark

View File

@ -32,6 +32,6 @@ IN: benchmark.recursive
HINTS: recursive fixnum ; HINTS: recursive fixnum ;
: recursive-main ( -- ) 10 recursive ; : recursive-benchmark ( -- ) 10 recursive ;
MAIN: recursive-main MAIN: recursive-benchmark

View File

@ -54,7 +54,7 @@ SYMBOL: clen
clen get number>string print clen get number>string print
length number>string print ; length number>string print ;
: regex-dna-main ( -- ) : regex-dna-benchmark ( -- )
knucleotide-in regex-dna ; knucleotide-in regex-dna ;
MAIN: regex-dna-main MAIN: regex-dna-benchmark

View File

@ -36,9 +36,9 @@ HINTS: do-line vector string ;
: reverse-complement-out ( -- path ) : reverse-complement-out ( -- path )
"reverse-complement-out.txt" temp-file ; "reverse-complement-out.txt" temp-file ;
: reverse-complement-main ( -- ) : reverse-complement-benchmark ( -- )
reverse-complement-in reverse-complement-in
reverse-complement-out reverse-complement-out
reverse-complement ; reverse-complement ;
MAIN: reverse-complement-main MAIN: reverse-complement-benchmark

View File

@ -21,7 +21,7 @@ SYMBOL: done
: ring-bench ( messages processes -- ) : ring-bench ( messages processes -- )
create-ring [ send-messages ] keep destroy-ring ; create-ring [ send-messages ] keep destroy-ring ;
: main-ring-bench ( -- ) : ring-benchmark ( -- )
1000 1000 ring-bench ; 1000 1000 ring-bench ;
MAIN: main-ring-bench MAIN: ring-benchmark

View File

@ -3,9 +3,9 @@
USING: fry kernel math random random.sfmt ; USING: fry kernel math random random.sfmt ;
IN: benchmark.sfmt IN: benchmark.sfmt
: sfmt-benchmark ( n -- ) : sfmt-bench ( n -- )
>fixnum 0x533d <sfmt-19937> '[ _ random-32* drop ] times ; >fixnum 0x533d <sfmt-19937> '[ _ random-32* drop ] times ;
: sfmt-main ( -- ) 10000000 sfmt-benchmark ; : sfmt-benchmark ( -- ) 10000000 sfmt-bench ;
MAIN: sfmt-main MAIN: sfmt-benchmark

View File

@ -1,7 +1,7 @@
USING: checksums checksums.sha sequences byte-arrays kernel ; USING: checksums checksums.sha sequences byte-arrays kernel ;
IN: benchmark.sha1 IN: benchmark.sha1
: sha1-file ( -- ) : sha1-benchmark ( -- )
2000000 iota >byte-array sha1 checksum-bytes drop ; 2000000 iota >byte-array sha1 checksum-bytes drop ;
MAIN: sha1-file MAIN: sha1-benchmark

View File

@ -25,7 +25,7 @@ IN: benchmark.simd-1
: simd-benchmark ( len -- ) : simd-benchmark ( len -- )
>fixnum make-points [ normalize-points ] [ max-points ] bi print-point ; >fixnum make-points [ normalize-points ] [ max-points ] bi print-point ;
: main ( -- ) : simd-1-benchmark ( -- )
10 [ 500000 simd-benchmark ] times ; 10 [ 500000 simd-benchmark ] times ;
MAIN: main MAIN: simd-1-benchmark

View File

@ -62,11 +62,11 @@ CONSTANT: number-of-requests 1000
server-promise get ?promise drop server-promise get ?promise drop
] benchmark . flush ; ] benchmark . flush ;
: socket-benchmarks ( -- ) : sockets-benchmark ( -- )
1 clients 1 clients
10 clients 10 clients
20 clients 20 clients
40 clients 40 clients
100 clients ; 100 clients ;
MAIN: socket-benchmarks MAIN: sockets-benchmark

View File

@ -62,7 +62,7 @@ IN: benchmark.spectral-norm-simd
TYPED: spectral-norm ( n: fixnum -- norm ) TYPED: spectral-norm ( n: fixnum -- norm )
u/v [ double cast-array ] bi@ [ v. ] [ norm-sq ] bi /f sqrt ; u/v [ double cast-array ] bi@ [ v. ] [ norm-sq ] bi /f sqrt ;
: spectral-norm-main ( -- ) : spectral-norm-simd-benchmark ( -- )
2000 spectral-norm . ; 2000 spectral-norm . ;
MAIN: spectral-norm-main MAIN: spectral-norm-simd-benchmark

View File

@ -49,7 +49,7 @@ IN: benchmark.spectral-norm
TYPED: spectral-norm ( n: fixnum -- norm ) TYPED: spectral-norm ( n: fixnum -- norm )
u/v [ v. ] [ norm-sq ] bi /f sqrt ; u/v [ v. ] [ norm-sq ] bi /f sqrt ;
: spectral-norm-main ( -- ) : spectral-norm-benchmark ( -- )
2000 spectral-norm number>string print ; 2000 spectral-norm number>string print ;
MAIN: spectral-norm-main MAIN: spectral-norm-benchmark

View File

@ -12,9 +12,9 @@ IN: benchmark.splay
: change-random ( newkeys splay keys -- splay' ) : change-random ( newkeys splay keys -- splay' )
swapd [ first pick delete-at first2 pick set-at ] 2each ; swapd [ first pick delete-at first2 pick set-at ] 2each ;
: run-splay ( -- ) : splay-benchmark ( -- )
100,000 initial-alist 10,000 cut 100,000 initial-alist 10,000 cut
[ >splay ] [ randomize 10,000 head ] bi [ >splay ] [ randomize 10,000 head ] bi
change-random keys dup natural-sort assert= ; change-random keys dup natural-sort assert= ;
MAIN: run-splay MAIN: splay-benchmark

View File

@ -45,9 +45,10 @@ SPECIALIZED-ARRAY: point
: print-point ( point -- ) : print-point ( point -- )
[ xyz [ number>string ] tri@ ] output>array ", " join print ; inline [ xyz [ number>string ] tri@ ] output>array ", " join print ; inline
: struct-array-benchmark ( len -- ) : struct-arrays-bench ( len -- )
make-points [ normalize-points ] [ max-points ] bi print-point ; make-points [ normalize-points ] [ max-points ] bi print-point ;
: main ( -- ) 10 [ 500000 struct-array-benchmark ] times ; : struct-arrays-benchmark ( -- )
10 [ 500000 struct-arrays-bench ] times ;
MAIN: main MAIN: struct-arrays-benchmark

View File

@ -8,7 +8,7 @@ IN: benchmark.sum-file
: sum-file ( file -- ) : sum-file ( file -- )
ascii [ 0 sum-file-loop ] with-file-reader . ; ascii [ 0 sum-file-loop ] with-file-reader . ;
: sum-file-main ( -- ) : sum-file-benchmark ( -- )
5 [ random-numbers-path sum-file ] times ; 5 [ random-numbers-path sum-file ] times ;
MAIN: sum-file-main MAIN: sum-file-benchmark

View File

@ -50,7 +50,7 @@ M: tcp-echo handle-client*
] with-client ] with-client
] with-threaded-server ; ] with-threaded-server ;
: tcp-echo-benchmark0 ( -- ) : tcp-echo0-benchmark ( -- )
4 test-size0 tcp-echo-benchmark ; 4 test-size0 tcp-echo-benchmark ;
MAIN: tcp-echo-benchmark0 MAIN: tcp-echo0-benchmark

View File

@ -3,7 +3,7 @@
USING: benchmark.tcp-echo0 io ; USING: benchmark.tcp-echo0 io ;
IN: benchmark.tcp-echo1 IN: benchmark.tcp-echo1
: tcp-echo-benchmark1 ( -- ) : tcp-echo1-benchmark ( -- )
5,000 64 tcp-echo-benchmark ; 5,000 64 tcp-echo-benchmark ;
MAIN: tcp-echo-benchmark1 MAIN: tcp-echo1-benchmark

View File

@ -3,7 +3,7 @@
USING: benchmark.tcp-echo0 io ; USING: benchmark.tcp-echo0 io ;
IN: benchmark.tcp-echo2 IN: benchmark.tcp-echo2
: tcp-echo-benchmark2 ( -- ) : tcp-echo2-benchmark ( -- )
5,000 1450 tcp-echo-benchmark ; 5,000 1450 tcp-echo-benchmark ;
MAIN: tcp-echo-benchmark2 MAIN: tcp-echo2-benchmark

View File

@ -8,7 +8,7 @@ TUPLE: point { x float } { y float } { z float } ; final
TUPLE-ARRAY: point TUPLE-ARRAY: point
: tuple-array-benchmark ( -- ) : tuple-arrays-benchmark ( -- )
100 iota [ 100 iota [
drop 5000 <point-array> [ drop 5000 <point-array> [
[ 1 + ] change-x [ 1 + ] change-x
@ -17,4 +17,4 @@ TUPLE-ARRAY: point
] map [ z>> ] map-sum ] map [ z>> ] map-sum
] map-sum . ; ] map-sum . ;
MAIN: tuple-array-benchmark MAIN: tuple-arrays-benchmark

View File

@ -5,6 +5,6 @@ TUPLE: hello n ;
: foo ( obj -- obj n ) 0 100000000 [ over n>> + ] times ; : foo ( obj -- obj n ) 0 100000000 [ over n>> + ] times ;
: typecheck-main ( -- ) 0 hello boa foo 2drop ; : typecheck1-benchmark ( -- ) 0 hello boa foo 2drop ;
MAIN: typecheck-main MAIN: typecheck1-benchmark

View File

@ -7,6 +7,6 @@ TUPLE: hello n ;
: foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ; : foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ;
: typecheck-main ( -- ) 0 hello boa foo 2drop ; : typecheck2-benchmark ( -- ) 0 hello boa foo 2drop ;
MAIN: typecheck-main MAIN: typecheck2-benchmark

View File

@ -7,6 +7,6 @@ TUPLE: hello n ;
: foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ; : foo ( obj -- obj n ) 0 100000000 [ over hello-n* + ] times ;
: typecheck-main ( -- ) 0 hello boa foo 2drop ; : typecheck3-benchmark ( -- ) 0 hello boa foo 2drop ;
MAIN: typecheck-main MAIN: typecheck3-benchmark

View File

@ -18,6 +18,6 @@ IN: benchmark.udp-echo0
] with-destructors ; ] with-destructors ;
: udp-echo0 ( -- ) 10,000 1 udp-echo ; : udp-echo0-benchmark ( -- ) 10,000 1 udp-echo ;
MAIN: udp-echo0 MAIN: udp-echo0-benchmark

View File

@ -3,6 +3,6 @@
USING: benchmark.udp-echo0 ; USING: benchmark.udp-echo0 ;
IN: benchmark.udp-echo1 IN: benchmark.udp-echo1
: udp-echo1 ( -- ) 10,000 200 udp-echo ; : udp-echo1-benchmark ( -- ) 10,000 200 udp-echo ;
MAIN: udp-echo1 MAIN: udp-echo1-benchmark

View File

@ -3,6 +3,6 @@
USING: benchmark.udp-echo0 ; USING: benchmark.udp-echo0 ;
IN: benchmark.udp-echo2 IN: benchmark.udp-echo2
: udp-echo2 ( -- ) 10,000 1450 udp-echo ; : udp-echo2-benchmark ( -- ) 10,000 1450 udp-echo ;
MAIN: udp-echo2 MAIN: udp-echo2-benchmark

View File

@ -1,7 +1,7 @@
USING: io kernel math.parser sequences ui.gadgets.panes ; USING: io kernel math.parser sequences ui.gadgets.panes ;
IN: benchmark.ui-panes IN: benchmark.ui-panes
: ui-pane-benchmark ( -- ) : ui-panes-benchmark ( -- )
[ 10000 iota [ number>string print ] each ] make-pane drop ; [ 10000 iota [ number>string print ] each ] make-pane drop ;
MAIN: ui-pane-benchmark MAIN: ui-panes-benchmark

View File

@ -86,7 +86,7 @@ TYPED: yuv>rgb ( rgb: byte-array yuv: yuv-buffer -- )
[ yuv>rgb-row ] with with each [ yuv>rgb-row ] with with each
drop ; drop ;
: yuv>rgb-benchmark ( -- ) : yuv-to-rgb-benchmark ( -- )
[ fake-data yuv>rgb ] with-destructors ; [ fake-data yuv>rgb ] with-destructors ;
MAIN: yuv>rgb-benchmark MAIN: yuv-to-rgb-benchmark