Merge branch 'master' of git://factorcode.org/git/factor

db4
John Benediktsson 2008-12-29 15:29:54 -08:00
commit 4e2b9bab48
2 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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 ;