ruby1.6 speed compared to 1.8 with/without threads

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

  1. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hallo,

    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 { Array.new(3000).join ':' }

    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

    Regards,

    - --
    Martin Povolny

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)
    Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

    iD8DBQFBT+nADbrC2YihQUkRAjP2AJ96XSc8uwffThiJ5UqUehASrJh1nACfX/mV
    Bdekb8DystxQ00mIOm5Uw0g=
    =ztuy
    -----END PGP SIGNATURE-----
     
    Martin Povolný, Sep 21, 2004
    #1
    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.