From: Chuck Remes Date: 2008-11-25T04:09:26+09:00 Subject: Re: Sieve of Zakiya On Nov 24, 2008, at 11:25 AM, jzakiya wrote: > On Nov 21, 1:31 am, Charles Oliver Nutter > wrote: >> Charles Oliver Nutter wrote: >>> brab...@gmail.com wrote: >>>> $ jruby -J-Xmn128m -J-Xms1024m -J-Xmx1024m -J-server >>>> SieveOfZakiya.rb >> >>>> Error, could not compile; pass -d or >>>> -J-Djruby.jit.logging.verbose=true for more details >> >>> Odd...the main script, or a method in it, must be gi-frigging- >>> gantic to >>> blow out the bytecode cap. Glad to see in your results below that >>> with a >>> bit of tweaking we're on par with 1.9. I'll look into the >>> compilation >>> issue; I know there are a few cases that can still pop the compiler, >>> like really big arrays that require a lot of init. >> >> Yeah, there's several methods there that could easily blow the cap >> and >> have to remain interpreted. The inability to compile the whole file >> as a >> result is probably a large part of the lower perf. The algorithm is >> also >> *extremely* memory-intensive; logging GC on JRuby it had to do >> multiple >> full collections before the first iteration even came back. >> >> - Charlie > > I just uploaded a more memory efficient and faster upgrade. > > Please check it out. On a Mac Pro (2.8 Ghz). Jruby 1.1.5 cremes$ jruby -J-Xmn128m -J-Xms1024m -J-Xmx1024m -J-server SieveOfZakiya.rb user system total real primes up to 10000001: 3.106000 0.000000 3.106000 ( 3.105799) primes up to 10000001: 5.774000 0.000000 5.774000 ( 5.773820) primes up to 10000001: 2.893000 0.000000 2.893000 ( 2.893756) primes up to 10000001: 7.883000 0.000000 7.883000 ( 7.883993) primes up to 10000001: 5.714000 0.000000 5.714000 ( 5.714248) primes up to 10000001: 4.792000 0.000000 4.792000 ( 4.791677) primes up to 10000001: 4.697000 0.000000 4.697000 ( 4.697211) primes up to 10000001: 4.066000 0.000000 4.066000 ( 4.065598) primes up to 10000001: 3.395000 0.000000 3.395000 ( 3.394890) primes up to 10000001: 3.232000 0.000000 3.232000 ( 3.232953) primes up to 10000001: 3.245000 0.000000 3.245000 ( 3.244323) Rubinius (built as of 5 minutes ago from latest git pull). I cancelled the run after an hour. It had not yet completed a single run. cr