lua-users home
lua-l archive

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


On 8 November 2015 at 02:52, Marco Atzori <marco.atzori.1983@gmail.com> wrote:
> Il 07/11/2015 16:46, Matthew Wild ha scritto:
>>
>> If you have actual constraints, revealing them might allow people to
>> help you better. If you don't have any constraints and just want it to
>> perform well, then there are some really much simpler and more
>> efficient solutions than your implementation.
>
> This code is part of a videogames addon, and is executed every frame refresh
> (about every tenth of a second) for which using tables created in
> continuation is a considerable waste of memory. If there are simpler
> solutions, show them to me as well. I asked your help for this reason ;-)
>

When I was writing addons for World of Warcraft, I was staggered at
the amount of Lua code that was being run every frame, combat event or
chat event by both the native UI and addons. I tried to make my code
as lean as possible, but a lot of wasn’t, particularly pure Lua
implementations of what would otherwise be written in C. My
not-very-modern computer ran it all flawlessly, so I don’t imagine
creating a table each frame will adversely affect performance. A lot
of garbage will be produced anyway, and the GC can deal with it.

Vaughan