[Gtkradiant] small optimization

James Canete smiletheory at gmail.com
Mon Feb 20 00:46:41 EST 2012

So I was running q3map2 through a profiler when I noticed that a lot of
time was being spent in VectorNormalize() in libs/mathlib/mathlib.c during
the -light phase.  I figured this was due to the math accuracy fixes, but I
also figured that there weren't really necessary during lighting, so I
borrowed the fast VectorNormalize2() from ioquake3 and used it in a couple
of key places during lighting.  I also went ahead and rewrote TraceLine_r()
in light_trace.c to be iterative when possible, while I was at it.

These two changes improved the light time on my test map by around 7% (or
one second, if you prefer), and don't seem to have any bad side effects,
though I haven't tried running the regression maps on it.

I put the patch at http://pastebin.com/uUED7Kt8 since I'm still not sure
where I should be submitting patches.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/gtkradiant/attachments/20120219/d07b470b/attachment.htm>

More information about the Gtkradiant mailing list