benchmark: assert some results.
parent
32ff5f4b9b
commit
8d08230f44
|
@ -46,10 +46,8 @@ CONSTANT: words { 24-from-1 24-from-2 24-from-3 24-from-4 }
|
|||
|
||||
: backtrack-benchmark ( -- )
|
||||
words [ reset-memoized ] each
|
||||
find-impossible-24 pprint "/10000 quadruples can make 24." print
|
||||
words [
|
||||
dup pprint " tested " write "memoize" word-prop assoc-size pprint
|
||||
" possibilities" print
|
||||
] each ;
|
||||
find-impossible-24 6479 assert=
|
||||
words [ "memoize" word-prop assoc-size ] map
|
||||
{ 1588 5137 4995 10000 } assert= ;
|
||||
|
||||
MAIN: backtrack-benchmark
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: math.ranges math.parser math.vectors sets sequences
|
||||
kernel io ;
|
||||
USING: kernel math.ranges math.parser sets sequences ;
|
||||
IN: benchmark.beust1
|
||||
|
||||
: count-numbers ( max -- n )
|
||||
1 [a,b] [ number>string all-unique? ] count ; inline
|
||||
|
||||
: beust1-benchmark ( -- )
|
||||
2000000 count-numbers
|
||||
number>string " unique numbers." append print ;
|
||||
2000000 count-numbers 229050 assert= ;
|
||||
|
||||
MAIN: beust1-benchmark
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: math math.ranges math.parser sequences kernel io locals ;
|
||||
USING: kernel locals math math.ranges math.parser sequences ;
|
||||
IN: benchmark.beust2
|
||||
|
||||
! http://crazybob.org/BeustSequence.java.html
|
||||
|
@ -34,6 +34,6 @@ IN: benchmark.beust2
|
|||
:: beust2-benchmark ( -- )
|
||||
0 :> i!
|
||||
5000000000 [ i 1 + i! ] count-numbers
|
||||
i number>string " unique numbers." append print ;
|
||||
i 7063290 assert= ;
|
||||
|
||||
MAIN: beust2-benchmark
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
! (c)Joe Groff bsd license
|
||||
USING: io kernel math.vectors.simd terrain.generation threads ;
|
||||
USING: accessors kernel math.vectors.simd terrain.generation ;
|
||||
FROM: alien.c-types => float ;
|
||||
IN: benchmark.terrain-generation
|
||||
|
||||
: terrain-generation-benchmark ( -- )
|
||||
"Generating terrain segment..." write flush yield
|
||||
<terrain> float-4{ 0 0 0 1 } terrain-segment drop
|
||||
"done" print ;
|
||||
<terrain> float-4{ 0 0 0 1 } terrain-segment
|
||||
dim>> { 512 512 } assert= ;
|
||||
|
||||
MAIN: terrain-generation-benchmark
|
||||
|
|
Loading…
Reference in New Issue