1 ! Copyright (C) 2008, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: binary-search kernel math.primes math.ranges memoize
4 prettyprint sequences ;
5 IN: benchmark.binary-search
7 MEMO: primes-under-million ( -- seq ) 1000000 primes-upto ;
9 ! Force computation of the primes list before benchmarking the binary search
10 primes-under-million drop
12 : binary-search-benchmark ( -- )
13 1 1000000 [a,b] [ primes-under-million sorted-member? ] map length . ;
15 MAIN: binary-search-benchmark