[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: optimising table creation; garbage collection
- From: Damian Stewart <damian@...>
- Date: Thu, 24 Aug 2006 16:31:34 +1200
Jim Whitehead II wrote:
Again, the bigger question asked by David is whether or not the overhead
of the table management (i.e. manually allocating and releasing) is
somehow more acceptable than the garbage you're creating.
well, i'm running a particle system in pure lua; one stage of it involved
summing and multiplying two 3D vectors four times per particle per frame.
it has a nice operator overloading inspired interface (Vector3:Plus,
Vector3:Times etc), but unfortunately each time you call Vector3:Plus it
creates a new Vector3 to store the result.
replacing these calls with manually splitting up the vectors into a bunch
of local variables (eg local px, local py, local pz) gave me a /3x
increase/ in frame rate. i went from being able to have 100 particles on
screen @60fps to 300 particles @60fps.
so yes :-)
--
f r e y
live music with machines
http://www.frey.co.nz