Skip to content

Instantly share code, notes, and snippets.

@methane
Last active December 15, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save methane/5268614 to your computer and use it in GitHub Desktop.
Save methane/5268614 to your computer and use it in GitHub Desktop.

10000行の代入を行うスクリプトを実行

Language time [ms]
Lua 10
Lua+cache 6
LuaJIT 7
Py2.7 60
Py2.7+cache 9
Py3.3 84
Py3.3+cache 16
Ruby 2.0 146
MBA [~]$ cat genfoo.py
for i in range(10000):
print("x{}={}".format(i, i))
print("""print(x9999)""")
MBA [~]$ python genfoo.py > foo.py
MBA [~]$ cp foo.py foo.lua
MBA [~]$ time python -S -c "import foo"
9999
real 0m0.075s
user 0m0.060s
sys 0m0.014s
MBA [~]$ time python -S -c "import foo"
9999
real 0m0.014s
user 0m0.009s
sys 0m0.005s
MBA [~]$ time lua -e "require 'foo'"
9999
real 0m0.016s
user 0m0.010s
sys 0m0.003s
MBA [~]$ luac -o foo.luac foo.lua
MBA [~]$ time lua -e "dofile('foo.luac')"
9999
real 0m0.010s
user 0m0.006s
sys 0m0.002s
MBA [~]$ time luajit -e "require 'foo'"
9999
real 0m0.012s
user 0m0.007s
sys 0m0.003s
MBA [~]$ cp foo.py foo.rb
MBA [~]$ time ruby2.0 -e "require './foo.rb'"
9999
real 0m0.158s
user 0m0.146s
sys 0m0.008s
MBA [~]$ time python3.3 -S -c "import foo"
9999
real 0m0.104s
user 0m0.084s
sys 0m0.017s
MBA [~]$ time python3.3 -S -c "import foo"
9999
real 0m0.025s
user 0m0.016s
sys 0m0.007s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment