Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

javascript vs lua

Name: Anonymous 2012-01-24 20:47

let's say i might be working on something ``secret'' and i want to embed a scripting language that isn't too off the wall for end users. i hear luajit is kinda fast and v8 is really fast and speed would be quite nice since user scripts might be called hundreds of thousands of times in short timeframes

i've heard javascript has better semantics and is generally more pleasant to use, but i want /prog/'s opinion so i don't fuck up and regret it later

Name: Anonymous 2012-02-18 19:27

>>140

Ported their fib benchmark (javascript version) to Lua.

Windows 7 x64, 2.66 GHz i5, 4GB RAM. Compiled luajit 2.0.0-beta9 using "Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64".

luajit.exe fib_julia.lua
Lua,fib,0.113

This compares favorably to their benchmarks: http://julialang.org/
https://github.com/JuliaLang/julia/tree/48d39c542f1b2f6049d1d21585e92e3c90705397/test/perf

--

function fib(n)
    if n < 2 then return n end
    return fib(n-1) + fib(n-2)
end

tmin = math.huge
for i=1, 5, 1 do
    t = os.clock()
    for j=1, 1000, 1 do
        assert(fib(20) == 6765)
    end
    t = os.clock()-t
    if t < tmin then tmin = t end
end

print("Lua,fib," .. tmin)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List