Discussion:
[Yafray-devel] Little Speed Optimization Patch
Alex Klein
2005-05-09 19:19:13 UTC
Permalink
Hi guys,
I've just started reading through the code and in order to understand it
I thought I try to profile and optimize it. Here's a little patch to
improve the performance a bit, about 7% on a small test scene I used.
For now I just restricted myself to reorganizing the
photonLight_t::illuminate(...) method. Here is what I did:

-added some const operators here and there (makes life easier for the
compiler to optimize the code)
-moved some computations such that they are executed just before they
are needed (lazy evaluation, better caching/optimization)
-set the vector to K elements at the beginning. This should completely
avoids reallocations
-reduce number of vector push/pop operations used
-replaced sqrt call by a compile-time constant

In addition, there are a few const operators in other files to make
optimization easier for the compiler.

The speed gain is not great, but hey, its free as the new version should
(and does in my test case ... maybe someone should use another scene to
test it just to be sure) produce the same results as the old one.


By the way, how far along is the refactorization? Does it make sense for
me to read through the code, suggest some further improvements and start
writing some doxygen comments in it? By the way, are you planning on
using doxygen? There is a conf-file in the CVS but there are hardly any
doxy-comments in the source...
Cheers

AlexK

P.S.: Hope the patch is in the right format, first time I've ever
submitted a patch to an open source project... :)
Alfredo de Greef
2005-05-10 03:01:55 UTC
Permalink
Thanks, this is code probably best looked at by Jandro
himself, but since he is seemingly still not able to
do any coding, and I guess probably also still doesn't
have net access, and since also the next release is
going to be the final release, I guess it is ok if I
just add it to current cvs. I'll have to do it by hand
though, since some code has changed now but still not
comitted.

As for the refactorization, apart from the 'fry'
module in cvs, which I guess you can call 'concept'
code, there are only the docs in the Blenderwiki here:
http://wiki.blender.org/bin/view.pl/Yafray/WebHome

Maybe Jandro has done more code without anyone else
yet knowing about it, but he can only tell that
himself.

Also, I didn't know this mailing list was still in
use, it might be better to post on the yafray forum
itself. There are also yafray mailing lists on
projects.blender.org but they don't seem to be in use.

Thanks for your contribution!

Alfredo 'Eeshlo' de Greef
Post by Alex Klein
Hi guys,
I've just started reading through the code and in
order to understand it
I thought I try to profile and optimize it. Here's a
little patch to
improve the performance a bit, about 7% on a small
test scene I used.
For now I just restricted myself to reorganizing the
photonLight_t::illuminate(...) method. Here is what
-added some const operators here and there (makes
life easier for the
compiler to optimize the code)
-moved some computations such that they are executed
just before they
are needed (lazy evaluation, better
caching/optimization)
-set the vector to K elements at the beginning. This
should completely
avoids reallocations
-reduce number of vector push/pop operations used
-replaced sqrt call by a compile-time constant
In addition, there are a few const operators in
other files to make
optimization easier for the compiler.
The speed gain is not great, but hey, its free as
the new version should
(and does in my test case ... maybe someone should
use another scene to
test it just to be sure) produce the same results as
the old one.
By the way, how far along is the refactorization?
Does it make sense for
me to read through the code, suggest some further
improvements and start
writing some doxygen comments in it? By the way, are
you planning on
using doxygen? There is a conf-file in the CVS but
there are hardly any
doxy-comments in the source...
Cheers
AlexK
P.S.: Hope the patch is in the right format, first
time I've ever
submitted a patch to an open source project... :)
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

Loading...