I realized that I had no idea how fast the parsers for some of these languages are. As someone who is interested in parsers, this piqued my interest. I was particularly interested to see how much precompiling would help.
To satisfy my curiosity, I wrote a quick little benchmark that tries to get some rough numbers on this. Source code is here: vm-parser-benchmark on GitHub. It's extremely quick and easy to run.
These are the results I got on my machine:
python real 0m1.521s user 0m1.184s sys 0m0.328s ruby real 0m0.523s user 0m0.441s sys 0m0.076s lua real 0m0.131s user 0m0.124s sys 0m0.005s python (precompiled) real 0m0.022s user 0m0.012s sys 0m0.009s lua (precompiled) real 0m0.005s user 0m0.002s sys 0m0.003s Version Information: Python 2.7.5 ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin13.0] Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-RioMore details on how I set this up are in the GitHub README. If anyone has interesting variants of my benchmark that show a different dimension of the problem space, I'd be interested to see them.
My takeaways from this are:
- There is a surprising amount of variation here. Python's parser probably has a lot of room for optimization. But the fact that precompiling is available probably reduces the demand for this considerably.
- Precompiling helps a lot.
- Lua continues to impress.