lua-users home
lua-l archive

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

On 07/06/2022 22:29, Paul Ducklin wrote:

Compilers not recognizing an expression or or unable to optimize it
would just parse it as it is without the `().

How would I, as the programmer, know which parts of my program might
be optimisable by all the various compiler variants out there? I’d
end up with backticks all over the place, like fleas crawling through
my source, trying to identify every part of my code that every
compiler variant might be able to optimise in some way.

If your compiler has its own unique ways of optimising my code, it
should just do that anyway for all the code it compiles. Anyway, if
you have several different optimisations, how would I mark up each
backtick to tell you which optimisation to apply in each case? That’s
the compiler’s job, surely?

So just treat every source file as though the whole thing is wrapped
it a “backtick bubble”…

You really hit the spot here. I was trying to make the same point with my previous message.

In particular two different compilers (or compiler settings) could perform some optimizations in different directions (e.g. memory vs speed), so I could get two very different results.

Taking this to the extreme: in one case I could get an out of memory error, while in another I could get the code to slow to a crawl. So I need to tell the compiler exactly which kind of optimization each expression needs.

Otherwise it's just a matter of global compiler flags (e.g. "compile the whole source optimizing for speed/size").

-- Lorenzo