[LRUG] REE vs Ruby 1.9.2

Ashley Moran ashley.moran at patchspace.co.uk
Mon Apr 4 03:19:28 PDT 2011

On 4 Apr 2011, at 10:19, Andrew Stewart wrote:

> http://www.rubyenterpriseedition.com/
> I know Ruby 1.9.2 is better than 1.8.7 in many ways, but does it improve memory usage etc to a degree similar to REE?

Hi Andrew

(First post BTW, hi all!)

We had the honour of having YARV developer Koichi Sasada attend ShRUG last year (he was working at Sheffield Hallam Uni for a while) and he gave us a brief demo of the memory improvements. YARV is more efficient at handling large numbers of small objects in some situations.

Compare the memory usage of this on 1.8.7 and 1.9.2:

    1> ~ % irb
    ruby-1.9.2-p180 :001 > a = []
     => [] 
    ruby-1.9.2-p180 :002 > 10_000_000.times { a << "a" }
     => 10000000 

On my MBP, that uses 630.3MB in 1.8.7 but only 452.0MB in 1.9.2. I haven't tried it in REE though :)

Interestingly, 1.8.7 wins in this case, with 176.0MB to 184.8MB:

    1> ~ % irb
    ruby-1.9.2-p180 :001 > a = ["a"] * 10_000_000

This surprised us all, but it turns out that contents of the array in this situation is 10 million references to the same "a" object, whereas above it is clearly not.



[1] http://shrug.org/


More information about the Chat mailing list