Fix benchmarks
parent
01ec501f83
commit
ce600b6aec
|
@ -1,10 +1,10 @@
|
||||||
USING: io.crc32 io.files kernel math ;
|
USING: io.crc32 io.encodings.ascii io.files kernel math ;
|
||||||
IN: benchmark.crc32
|
IN: benchmark.crc32
|
||||||
|
|
||||||
: crc32-primes-list ( -- )
|
: crc32-primes-list ( -- )
|
||||||
10 [
|
10 [
|
||||||
"extra/math/primes/list/list.factor" resource-path
|
"extra/math/primes/list/list.factor" resource-path
|
||||||
file-contents crc32 drop
|
ascii file-contents crc32 drop
|
||||||
] times ;
|
] times ;
|
||||||
|
|
||||||
MAIN: crc32-primes-list
|
MAIN: crc32-primes-list
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
IN: benchmark.mandel
|
IN: benchmark.mandel
|
||||||
USING: arrays io kernel math namespaces sequences strings sbufs
|
USING: arrays io kernel math namespaces sequences
|
||||||
math.functions math.parser io.files colors.hsv
|
byte-arrays byte-vectors math.functions math.parser io.files
|
||||||
io.encodings.ascii ;
|
colors.hsv io.encodings.binary ;
|
||||||
|
|
||||||
: max-color 360 ; inline
|
: max-color 360 ; inline
|
||||||
: zoom-fact 0.8 ; inline
|
: zoom-fact 0.8 ; inline
|
||||||
|
@ -54,18 +54,18 @@ SYMBOL: cols
|
||||||
: ppm-header ( w h -- )
|
: ppm-header ( w h -- )
|
||||||
"P6\n" % swap # " " % # "\n255\n" % ;
|
"P6\n" % swap # " " % # "\n255\n" % ;
|
||||||
|
|
||||||
: sbuf-size width height * 3 * 100 + ;
|
: buf-size width height * 3 * 100 + ;
|
||||||
|
|
||||||
: mandel ( -- string )
|
: mandel ( -- data )
|
||||||
[
|
[
|
||||||
sbuf-size <sbuf> building set
|
buf-size <byte-vector> building set
|
||||||
width height ppm-header
|
width height ppm-header
|
||||||
nb-iter max-color min <color-map> cols set
|
nb-iter max-color min <color-map> cols set
|
||||||
render
|
render
|
||||||
building get >string
|
building get >byte-array
|
||||||
] with-scope ;
|
] with-scope ;
|
||||||
|
|
||||||
: mandel-main ( -- )
|
: mandel-main ( -- )
|
||||||
mandel "mandel.ppm" temp-file ascii set-file-contents ;
|
mandel "mandel.ppm" temp-file binary set-file-contents ;
|
||||||
|
|
||||||
MAIN: mandel-main
|
MAIN: mandel-main
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
USING: io.files random math.parser io math ;
|
USING: io.files io.encodings.ascii random math.parser io math ;
|
||||||
IN: benchmark.random
|
IN: benchmark.random
|
||||||
|
|
||||||
: random-numbers-path "random-numbers.txt" temp-file ;
|
: random-numbers-path "random-numbers.txt" temp-file ;
|
||||||
|
|
||||||
: write-random-numbers ( n -- )
|
: write-random-numbers ( n -- )
|
||||||
random-numbers-path [
|
random-numbers-path ascii [
|
||||||
[ 200 random 100 - number>string print ] times
|
[ 200 random 100 - number>string print ] times
|
||||||
] with-file-writer ;
|
] with-file-writer ;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
USING: float-arrays compiler generic io io.files kernel math
|
USING: float-arrays compiler generic io io.files kernel math
|
||||||
math.functions math.vectors math.parser namespaces sequences
|
math.functions math.vectors math.parser namespaces sequences
|
||||||
sequences.private words io.encodings.ascii ;
|
sequences.private words io.encodings.binary ;
|
||||||
IN: benchmark.raytracer
|
IN: benchmark.raytracer
|
||||||
|
|
||||||
! parameters
|
! parameters
|
||||||
|
@ -167,9 +167,9 @@ DEFER: create ( level c r -- scene )
|
||||||
levels { 0.0 -1.0 0.0 } 1.0 create ray-trace [
|
levels { 0.0 -1.0 0.0 } 1.0 create ray-trace [
|
||||||
size size pgm-header
|
size size pgm-header
|
||||||
[ [ oversampling sq / pgm-pixel ] each ] each
|
[ [ oversampling sq / pgm-pixel ] each ] each
|
||||||
] "" make ;
|
] B{ } make ;
|
||||||
|
|
||||||
: raytracer-main
|
: raytracer-main
|
||||||
run "raytracer.pnm" temp-file ascii set-file-contents ;
|
run "raytracer.pnm" temp-file binary set-file-contents ;
|
||||||
|
|
||||||
MAIN: raytracer-main
|
MAIN: raytracer-main
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
USING: kernel sequences sorting benchmark.random math.parser
|
USING: kernel sequences sorting benchmark.random math.parser
|
||||||
io.files ;
|
io.files io.encodings.ascii ;
|
||||||
IN: benchmark.sort
|
IN: benchmark.sort
|
||||||
|
|
||||||
: sort-benchmark
|
: sort-benchmark
|
||||||
random-numbers-path file-lines [ string>number ] map natural-sort drop ;
|
random-numbers-path
|
||||||
|
ascii file-lines [ string>number ] map
|
||||||
|
natural-sort drop ;
|
||||||
|
|
||||||
MAIN: sort-benchmark
|
MAIN: sort-benchmark
|
||||||
|
|
Loading…
Reference in New Issue