Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In order to eliminate the potential bias of startup time I run similar test in many iterations. Here's what I got:

    $ time ruby -e "10000.times { puts 'hello world' }" > /dev/null
    real    0m0.102s
    user    0m0.096s
    sys     0m0.005s
and

    $ time ./topaz -e "10000.times { puts 'hello world' }" > /dev/null
    real    0m0.098s
    user    0m0.071s
    sys     0m0.026s
Any idea why I don't see such big difference?


topaz probably has a pretty slow IO (for bad reasons, it's an RPython problem)


Because the majority of the cycles ran are probably in 'puts', which is implemented in C if I were to guess.


The overhead of starting the interpreter must be longer that executing the loop.


Because a puts loop is I/O bound, not CPU bound.


what is your 'ruby'?


Good question. How many shells is rbenv/rvm executing? Do you get similar results with an absolute path?


ruby that comes with Debian Squeeze.

    $ ruby --version
    ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux]




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: