[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.4.0 (work2) now available
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 24 Aug 2018 10:42:09 +0200
Given Lua's position as an extension language embedded in a C host,
would not simply invoking fmod from math.h be the obvious thing to do?
Op Do., 23 Aug. 2018 om 19:04 het Roberto Ierusalimschy
<roberto@inf.puc-rio.br> geskryf:
>
> > 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: https://stackoverflow.com/a/51561685/6834680
> > (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
> floats.
>
> 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
>