ruby1.6 speed compared to 1.8 with/without threads

Discussion in 'Ruby' started by Martin Povolný, Sep 21, 2004.

    Hash: SHA1


    while porting our software from ruby1.6 to ruby1.8, we found some
    performance issues.

    Especially it seems that compiling ruby1.8 with pthreads enabled
    (the way package is made in Debian GNU/Linux) gives poor results.

    I wonder if other people have noticed this?

    TEST: 1000.times { a = []; 4000.times {a << 1} }

    ruby1.8 without pthread: 6.679s
    ruby1.8 with pthread: 10.576s
    ruby1.6: 5.755s

    TEST: 1000.times { ':' }

    ruby1.8 without pthread: 8.087s
    ruby1.8 with pthread: 10.503s
    ruby1.6: 7.810s

    TEST: 1000.times { s = ''; 2000.times {s << 'hello'} }

    ruby1.8 without pthread: 5.030s
    ruby1.8 with pthread: 6.807s
    ruby1.6: 7.099s

    TEST: 1000.times { def a; 'hello'; end; 2000.times { a } }

    ruby1.8 without pthread: 5.311s
    ruby1.8 with pthread: 8.386s
    ruby1.6: 4.116s

    TEST: 1000.times { h = {}; 1000.times {|t| h[t] = 'hello' } }

    ruby1.8 without pthread: 4.064s
    ruby1.8 with pthread: 6.436s
    ruby1.6: 3.461s

    TEST: 1000.times { 200.times {|t| eval('$test%d = \'hello\'' % t) } }

    ruby1.8 without pthread: 6.816s
    ruby1.8 with pthread: 8.507s
    ruby1.6: 5.630s

    TEST: 1000.times { ('X' * 100000).sub(/X/) {|s| s.downcase} }

    ruby1.8 without pthread: 7.843s
    ruby1.8 with pthread: 7.977s
    ruby1.6: 7.405s


    - --
    Martin Povolny

    Version: GnuPG v1.2.4 (GNU/Linux)
    Comment: Using GnuPG with Thunderbird -

    -----END PGP SIGNATURE-----
    Martin Povolný, Sep 21, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.