Take this naive fibonacci function: function fib(n) return n<2 and n or fib(n-1)+fib(n-2) end print(fib(30))
On my machine, it completes in less than a second on PNaCl, but takes nearly 10 seconds to complete in emscripten.
Take this naive fibonacci function: function fib(n) return n<2 and n or fib(n-1)+fib(n-2) end print(fib(30))
On my machine, it completes in less than a second on PNaCl, but takes nearly 10 seconds to complete in emscripten.
http://kripken.github.io/lua.vm.js/repl.html
But even that is already out of date ;) just this week I found that I was building Lua with a bad choice of optimization flags. We include Lua VM benchmarks in the emscripten test suite, so for the latest numbers (with the proper optimization flags), see
https://docs.google.com/spreadsheet/ccc?key=0AkuGewEm05tZdFd...
It's possible to run the Lua VM in JS at only about 50% slower than a native build.
edit: fix link
Regarding lua, I updated the lua vm project, and tried your fibonacci function from before in the repl
http://kripken.github.io/lua.vm.js/repl.html
Looks like in both firefox and chrome it runs in about a second in JS, which feels about the same as the time it takes in PNaCl in chrome on