- Anonymous functions as parameters were 10x slower
- pairs and ipairs are twice as slow as regular for loops
- table.insert was 7x slower than regular access
Are there any Löve-specific performance tips that people should know about?
Yep, totally.benhumphreys wrote: I guess this all applies to Löve Lua code too?
I can redirect you to this thread, maybe you'll find a lot more inspiring tips.benhumphreys wrote: Are there any Löve-specific performance tips that people should know about?
However you define it in this context, all or none of the functions in Lua are anonymous. Wikipedia says all are considered anonymous.benhumphreys wrote:
- Anonymous functions as parameters were 10x slower
The for iterators include function calls. A function call is generally a slow thing.benhumphreys wrote:
- pairs and ipairs are twice as slow as regular for loops
Besides it being a function, table.insert does more than just add a value to a index. It also reorders the table if the value is inserted in the middle of the sequence.benhumphreys wrote:
- table.insert was 7x slower than regular access
i guess creating new functions like that is common for more functionalish stuff. also, sometimes you're pretty much forced to create a closure.Boolsheet wrote:That link did indeed already come up a few times.
However you define it in this context, all or none of the functions in Lua are anonymous. Wikipedia says all are considered anonymous.benhumphreys wrote:
- Anonymous functions as parameters were 10x slower
Anyway, creating a new function for every call is slow. Creating the same function over and over is not smart. Why did they even use that code example?
Code: Select all
function newFoo(...)
local self = {...}
function self:bar()
-- something something
end
return self
end
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 4 guests