lua-users home
lua-l archive

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


Michael Abbott wrote:
> Lua code isn't something I'd consider
to be that amenable to optimisations (at least in a similar fashion to how a language like C is).

This is mostly because of the dynamic-typedness.

I agree that the dynamic-typedness makes many classes of
optimizations extremely difficult even with global
analysis, though I recall seeing plenty of papers floating
around for optimization strategies in such languages.

A few low-hanging fruit remain pretty doable though, in
theory.  Two examples I can think of would be (sub-)expressions
that definitely evaluate to constants, and locals (including
local functions) whose scopes render their values absolutely
known at compile-time in various contexts (and thus potentially
inlineable).

I have real-life lua code which could benefit from either
of these optimizations (since manually applying these
optimizations would have greatly damaged maintainability
and clarity), but in the grand scheme of things these
are probably fairly small and un-radical speedups in
real life.  Still not unwelcome.

--Adam
--
Adam D. Moss   -   adam@gimp.org