[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Ideas for faster math in lua
- From: Niklas Frykholm <niklas@...>
- Date: Fri, 15 Feb 2008 09:12:29 +0100
I would like to be able to process lots of small mathematical objects
(vector3 and quaternions) in a resource constrained environment (computer
game), without having to pay the cost of new-ing and garbage collecting
them. I.e. I would just like to reuse a pool of existing objects.
Did you meet performance problems or are you just anticipating them?
I am seeing performance issues.
Since I am on a memory constrained platform I have to sweep aggressively
to keep the memory use down. The more garbage that is created per frame,
the more time I have to spend sweeping each frame to keep up.
Currently I have about 1000 lua allocations per frame and garbage
collection times in the range of 1.7 - 2.7 ms, depending on where I am
in the scene. That is 10 - 16 % of a 60 Hz frame rate. It is not a
complete show stopper, but I'd rather be doing something more
interesting with those 10 - 16 % than garbage collection.
This means that I have to create less garbage. And the primary cause of
garbage are the mathematical computations on vector3s.