[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Ideas for faster math in lua
- From: Miles Bader <miles.bader@...>
- Date: Fri, 15 Feb 2008 17:38:16 +0900
Niklas Frykholm <firstname.lastname@example.org> writes:
> This means that I have to create less garbage. And the primary cause of
> garbage are the mathematical computations on vector3s.
I'm not sure how you could do much better without either language
support or a big change in coding style.
I've seen similar code in Java (where it's an even bigger deal, I guess,
because Java has better compilers), where they basically (1) always use
"3 address" forms of operators, with an explicit target parameter that
gets overwritten, (2) always use "manual" allocation for small objects
like that, either explicitly allocating and freeing them from a
free-list like arena, or keeping static objects around for temporaries
you know don't have to be reentrant. Both make for ugly code, and the
manual MM can be a big pain, but...
[This is certainly one area where C++ shines...]
Rational, adj. Devoid of all delusions save those of observation, experience