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

Lua is much faster than Ruby/Python/Perl/&c. It still doesn't get close even to the higher-level compiled languages like Common Lisp and Haskell, but e.g. the programming language shootout [1] makes it pretty clear that Lua is still a league above the other dynamic languages. For just a quick result, I tried timing just the Hello World program in Python, Ruby, and Lua, and while startup time isn't going to be the bottleneck of the world of modern web development, it's still a telling result:

    $ time python2.7 -c "print 'Hello, world'"
    
    real        0m0.107s
    user        0m0.080s
    sys         0m0.023s
    $ time ruby -e "puts 'Hello, world'"
    Hello, world
    
    real        0m0.338s
    user        0m0.030s
    sys	        0m0.013s
    $ time lua -e "print('Hello, world')"
    Hello, world
    
    real        0m0.008s
    user        0m0.000s
    sys         0m0.003s
That said, I kneejerk-ly agree with you about Lua being an awkward medium for expressing programs. I personally haven't ever gotten to the status where Lua was as natural as Python, but I have also used Python a great deal more, so I don't know if my attitude is attributable to Lua's design, or Python's plenitude of libraries, or merely the experience differential between the two.

[1]: http://shootout.alioth.debian.org/

EDIT: Converted some tabs to spaces. (Nitpicky, I know.)



My timings where different on my 6 yr old Pentium D dual core, Ubuntu 64 bit:

  time python2.7 -c "print 'Hello, world'" && time ruby -e     
  "puts 'Hello, world'" && time lua -e "print('Hello, 
  world')"

  Hello, world

   real	0m0.056s
   user	0m0.040s
   sys	0m0.000s

  Hello, world

   real	0m0.008s
   user	0m0.000s
   sys	0m0.000s
 
  Hello, world

   real	0m0.061s
   user	0m0.000s
   sys	0m0.010s


My guess is that your ruby is loading rubygems on startup. It shouldn't take nearly that long if you don't.

That said, startup times are often not as important as other metrics.




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

Search: