lua-users home
lua-l archive

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


Dylan wrote:

frog = Vector{ 10, 20, 30 } + Vector{ 20, 30, 40 } + Vector{ 30, 40, 50 }

Right now, If I have 400 aliens each doing pos = pos + vec1 + vec2 + vec3, I
get a leak of 400x3x16=20K each frame.. at 60fps that's 115k a second...6.9
meg a minute...4 gigabytes an hour... and that's without any lua table
structures or malloc overheads in my calculation.

That's only if those vectors are literals, and you're naively reinstancing them on every frame like in your frog example. If you have any constants, it's best to name them and keep them around in a table. In other words, if it hurts when you create stuff, don't create so much stuff.


--
http:// if   l .o  /