1 # Adapted for JRuby benchmarking based on...
3 # The Computer Language Shootout
4 # http://shootout.alioth.debian.org/
6 # contributed by Glenn Parker, March 2005
7 # modified by Evan Phoenix, Sept 2006
11 flags = Flags.dup[0,m]
29 n = (ARGV[0] || 2).to_i
31 Flags = "\x1" * ( 2 ** n * 10_000)
33 puts Benchmark.measure {
34 n.downto(n-2) do |exponent|
36 m = (1 << exponent) * 10_000
37 # m = (2 ** exponent) * 10_000
39 printf "Primes up to %8d %8d\n", m, count
43 puts Benchmark.measure {
44 n.downto(n-2) do |exponent|
46 m = (1 << exponent) * 10_000
47 # m = (2 ** exponent) * 10_000
49 printf "Primes up to %8d %8d\n", m, count