Merge branch 'master' of git://factorcode.org/git/factor
commit
4e2b9bab48
|
@ -1,10 +1,13 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: binary-search math.primes.list math.ranges sequences
|
USING: binary-search kernel math.primes.list math.ranges sequences
|
||||||
prettyprint ;
|
prettyprint ;
|
||||||
IN: benchmark.binary-search
|
IN: benchmark.binary-search
|
||||||
|
|
||||||
: binary-search-benchmark ( -- )
|
: binary-search-benchmark ( -- )
|
||||||
1 1000000 [a,b] [ primes-under-million sorted-member? ] map length . ;
|
1 1000000 [a,b] [ primes-under-million sorted-member? ] map length . ;
|
||||||
|
|
||||||
|
! Force computation of the primes list before benchmarking the binary search
|
||||||
|
primes-under-million drop
|
||||||
|
|
||||||
MAIN: binary-search-benchmark
|
MAIN: binary-search-benchmark
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: math.primes ;
|
USING: math.primes memoize ;
|
||||||
IN: math.primes.list
|
IN: math.primes.list
|
||||||
|
|
||||||
: primes-under-million ( -- seq ) 1000000 primes-upto ;
|
MEMO: primes-under-million ( -- seq ) 1000000 primes-upto ;
|
||||||
|
|
Loading…
Reference in New Issue