[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Does lua optimize the collection of "anonymous" tables?
- From: Andrew Starks <andrew.starks@...>
- Date: Mon, 18 Nov 2013 08:42:15 -0600
On Sun, Nov 17, 2013 at 11:54 PM, William Ahern
> If you think it'll matter to you, you should benchmark it and share your
> data on this mailing-list. If it helps you, you might save the generational
> GC from deletion. If not, then you would have answered your question better
> than anybody on this list could have.
Sage advice and thank you for reminding me of it.
We have an AST of filters that are controlled by a coroutine running
in a Lua VM. The application is a broadcast video server and the VM
provides the state for each media segment (frame). So this could be
1/25th - /180th of a second.
Each filter has different states, most of which can change (but most
of which do not change) on every frame.
The cleanest way to pass these state variables back and forth would be
to do it in a table. and not in positional arguments.
Right now, we do *some* amount of work to minimize new tables on the
theory that even if it is fast enough, any extra time could be used by
the filter to do its work.
I wasn't certain that this theory made sense because I didn't know if
there were certain cases where the normal rules don't apply.
I usually avoid engaging in pre-optimization when it gets in the way
of simplicity. In this case, it seems prudent to avoid creating tables
on every loop.
I'm not sure about which path I'll take...