4 ms·
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 'hell
by grn 14y ago
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?
- emillon 14y agoThe overhead of starting the interpreter must be longer that executing the loop.
- fijal 14y agotopaz probably has a pretty slow IO (for bad reasons, it's an RPython problem)
- fernandezpablo 14y agowhat is your 'ruby'?
- onedognight 14y agoGood question. How many shells is rbenv/rvm executing? Do you get similar results with an absolute path?
- grn 14y agoruby that comes with Debian Squeeze. $ ruby --version ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux]
- duaneb 14y agoBecause the majority of the cycles ran are probably in 'puts', which is implemented in C if I were to guess.
- rbehrends 14y agoBecause a puts loop is I/O bound, not CPU bound.