lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I was just sitting and goofing around and then it hit me .. Benchmarks!
The mother of all flaming and discussion! Why dont I have a Lua
benchmark tools.. So here it is, the first tiny Lua benchmark:

------------------
function sieve(n)
  x = {}
  iter = 0
  repeat
    x[1] = 0
    i = 2
    repeat
      x[i] = 1
      i = i + 1
    until i > n
    p = 2
    while(p * p <= n) do
      j = p
      while(j <= n) do
        x[j] = 0
        j = j + p
      end
      repeat
        p = p + 1
      until x[p] == 1
    end
    iter = iter + 1
  until iter == 101
end

print("Sieve of Eratosthenes - Lua Benchmark test 0.00001")
print("Start testing .....")
start = clock()
sieve(100000)
stop = clock()
print("Done!")
print("Total Time = "..(stop - start))
----------------------

Compiler: Watcom C 11.0b Optimized for Speed - Target Win32 Console
Lua version: 3.2 (My multi state version)

Results:
--------
Compaq 133 Mhz Laptop Windows 98   = 363.17
IBM 400 Mhz Pentium II Windows 2000 = 106.363


:-) Erik