Surprising Result

I’d just gotten done implementing DEFLATE in pure ruby, and figuring
there’d be a performance hit I was interested to see what it would be.
On IronRuby (compiled in Release) it takes a full 16 seconds to
decompress a ~1KB file… in CRuby it’s less then a second. An ~800KB
file takes 42 seconds in CRuby, while IronRuby takes a whopping…
well I don’t know, I killed it after it was running for about a half
hour and using upwards of 100MB of memory!

Now this is just a straight port of “puff.c” from the zlib library, so
it’s certainly not optimized for speed in any way, but the difference
in runtimes really struck me.

I suppose at the very least we have a good stress test for rbx :wink:
Just thought I’d share.


Michael L.
[Polymath Prokrammer]
http://blog.prokrams.com

Michael L.:

in runtimes really struck me.

I suppose at the very least we have a good stress test for rbx :wink: Just
thought I’d share.

Cool :slight_smile: Can you send along the source code for your implementation so we
can investigate?

Thanks
-John

I’ll be posting it up (probably on RubyForge) once I get cleaned up a
bit (acknowledgments, rdoc stuff), if you want the raw stuff I can
email it straight to you.

On Mon, Mar 10, 2008 at 5:33 PM, John L. (DLR) [email protected]
wrote:

hour and using upwards of 100MB of memory!
Thanks
-John


Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Michael L.
[Polymath Prokrammer]
http://blog.prokrams.com

Don’t know what I’m going to do with a nickel…

Actually since it’s basically a port of a c program I’m only really
using blocks in two places, input and output, plus on other little
place… I can try but I’d be surprised… unless for loops in a range
count…

On Mon, Mar 10, 2008 at 6:37 PM, Eric N. [email protected]
wrote:

bit (acknowledgments, rdoc stuff), if you want the raw stuff I can

Now this is just a straight port of “puff.c” from the zlib library,

[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Michael L.
[Polymath Prokrammer]
http://blog.prokrams.com

Alright, I’ll bet you a beer next time you’re in Raleigh, NC. :slight_smile:

For… in loops seem to use blocks. Anyway, in a quick test they seem
to be
about 200 - 1000 times slower than an equivalent while loop. A quick
test
that runs through 1000 iterations 2000 times takes 0.3s with a while
loop,
and 9.0s with a for loop on my system.

Try a while loop…
-Eric

On Mon, Mar 10, 2008 at 6:44 PM, Michael L. <

I bet you a nickel that if you replace a few key block loops (i.e. each,
times, etc) with a vanilla while loop that you’ll see a 10x speedup…
I’ve
seen some really huge performance hits on IR using blocks.

-Eric
On Mon, Mar 10, 2008 at 6:06 PM, Michael L. <

So I did some testing on this, I wrapped all loops in an outer while
loop and ran them though both rbx and cruby:
i.e.
t = 0
while t < 2000
for i in (1…1000)
end
t+=1
end

cruby:
while: 0:01.22
for: 0:00.46
times: 0:00.75

rbx:
while: 0:01.83
for: 0:24.53
times: 0:24.84

Of course this is just a couple of runs, it would be more accurate to
do a whole suite and average them out, but I ran them a few times and
the times were relatively consistent.

Work to be done…

On Tue, Mar 11, 2008 at 9:57 AM, Eric N. [email protected]
wrote:

On Mon, Mar 10, 2008 at 5:33 PM, John L. (DLR) [email protected]

On IronRuby (compiled in Release) it takes a full 16 seconds to
so
we can investigate?

Ironruby-core mailing list

http://rubyforge.org/mailman/listinfo/ironruby-core


Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core


Michael L.
[Polymath Prokrammer]
http://blog.prokrams.com