General question about performance
View Single Post
07-07-19, 02:40 AM
A Theradrim Guardian
Join Date: Jan 2010
Originally Posted by
The global environment is basically stored in a big table. Every time you want to read from this table you perform a table indexing operation, which takes a small amount of time. However, if code is run very often (think combat log events or every frame render), you may want to shave off as much time as possible. Local variables are stored as Lua registers, which are much quicker to access than the global environment.
and others like this cause more than one indexing operation as denoted by the dot. The first is retrieving
from the global environment and the second is to index
. Creating a local reference of this saves 2 indexing operations as a result.
Thx for that explanation!
View Public Profile
Send a private message to Lybrial
Find More Posts by Lybrial