1 2
8 9
Skilled player (1707)
Joined: 9/17/2009
Posts: 4952
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Masterjun wrote:
Yes locals are faster. Yes they are faster everywhere. Yet I don't understand your question.
Thanks. I meant I was wondering if something like this makes sense:
Language: lua

while true do local memoryreadbyte = memory.readbyte local emuframeadvance = emu.frameadvance --Using "localized" functions: local test = memoryreadbyte(0x0000) emuframeadvance() end
for every single BizHawk function as well.
Masterjun
He/Him
Site Developer, Skilled player (1971)
Joined: 10/12/2010
Posts: 1179
Location: Germany
Well it certainly doesn't make sense if you redefine the locals in every loop. Define them once before the loop and, yes, calling them will have a speedup of around 5%. However, keep in mind that's like 0.4 microseconds per call, so read the start of the page again: We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. So in reality, you don't want to do this.
Warning: Might glitch to credits I will finish this ACE soon as possible (or will I?)
1 2
8 9