lua-users home
lua-l archive

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

Eduardo bart’s numbers are certainly very good.

Several years ago (in the Lua 5.2 days) I ran into some really big performance problems in a Lua app we were supporting.  We got huge improvements (10x or more iirc) by being more careful in coding, tailoring the code to Lua’s characteristics.  Two big changes that I recall were 1) using local wherever possible and 2) doing simple optimizations like pulling constant evaluations out of loops.  


On Aug 20, 2020, at 10:00 AM, Eduardo Bart <> wrote:

I've tested -O3 -march=native and it makes no difference for my use case. I tend to avoid O3 unless on code that I know math operations could be vectorized, like in a matrix library, I don't think O3 can do much in the Lua interpreter. Also O3 can generate more code and bigger binaries, under certain circumstances this can be slower.

Em qui., 20 de ago. de 2020 às 10:23, v <> escreveu:
On Thu, 2020-08-20 at 08:50 -0300, Eduardo Bart wrote:
> 1. Setting a baseline.
> My baseline is the Lua 5.4 interpreter using just "-O2" optimization
> in CFLAGS,
> Other things I've tried and made almost no difference:
> * Adding -march=native CFLAGS.

I suspect that -march=native might have bigger impact at -O3, where
automatic vectorization is allowed, so machine-specific boost from
-march becomes more noticable. Can't say this reliably.

Either way, -O3 alone may raise performance.
v <>