lua-users home
lua-l archive

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

> I've tested the performance of one program under Lua 5.1 / 5.2 / 5.3 / 5.4
> The program is just a calculator of SHA512 written for Lua 5.1, all bitwise
> operations are emulated with arithmetic.
> The code is here:
> (the code consists of two files: the module and the testing/benchmarking
> script)
> All Lua executables under test are 64-bit, built with the same script under
> the same compiler.
> So, the benchmarking is fair.
> C:\>lua51.exe sha2for51_test.lua
> CPU seconds:    12.371
> C:\>lua52.exe sha2for51_test.lua
> CPU seconds:    12.513
> C:\>lua53.exe sha2for51_test.lua
> CPU seconds:    16.801
> C:\>lua54.exe sha2for51_test.lua
> CPU seconds:    15.6

At least in my machine, this time difference mainly boils down to
the mod operation. If I compile lua 5.4 using the old (but slightly
wrong) definition for '%', Lua 5.4 runs 4% slower than Lua 5.1, which
I think is due to the high number of coercions between integers and

We can try to improve the implementation of '%' for floats, but
I am not sure it is worth, given that, with integers and bitwise
operations, that kind of use of '%' for floats is much diminished.

-- Roberto