Allow me to forward you to patch [ 1655333 ] :
http://sourceforge.net/tracker/index.php?func=detail&aid=1655333&group_id=24884&atid=382801
> You have introduced one more
> division and two more multiplications instead of a call to dCopySign() which
> is usually executed by ALU. What have you optimized? You think you made less
> code? Let the optimization to be done by compiler. It will do it much better
> than you.
The patch says "For the function I'm getting 16% of improvement and
for the quickstep I'm 5% faster." (You may not know) Remi has
submitted dozens of little patches like this, there seemed no reason
to doubt his word so I commited it to SVN - 16% sounds nice to me.
Anyway, I think Remi has SVN access now, so you can ask him about it
... although if you look at the dates involved this is not what I'd
call a 'recent commit'.
Dave
Good catch. Fixed.
--
Daniel K. O.
"The only way to succeed is to build success yourself"
Yep, I'm the one who made the patch at the time were I did not have svn
access.
What the patch does it to play with the index of the array instead of
creating temporary variables.
The patch does one more division but recreate less variables and does
less assignment.
The timing was done with devPartner profiling tools and running a real
application.
If Oleh is able to optimize it further I see no problem with it. I'm
always ready to learn.
(Now I'm reading Code Optimization: Effective memory usage. Intersting
night time book. ;-) )
Remi
Oleh Derevenko
-- ICQ: 36361783
> How can you explain this magical improvement in 16%? Could you point where
> exactly in the code it is? The function is not that big to get the
> improvement from code size decrease. And if to compare new and old variants
> all the execution paths became longer.
> Can we have a test program which illustrates that improvement (for example
> calls dNormalize3 for a million of pre-generated random vectors and measures
> execution time)?
>
Go to the patch page of ODE
cl /D "WIN32" /I"C:/Program Files/Microsoft Visual Studio/VC98/Include"
/Ix:/sim/include /Lx:/sim/lib x:/sim/lib/timer.lib user32.lib
testdNormalize3.cpp /link /nodefaultlib:"libc.lib"
/nodefaultlib:"libcmt.lib"
There is the file you want it is called testdNormalize3.cpp
it test different version of the function.
If I remember correctly the 16% is on the execution of the real program
since this function is called many many time.
I don't recall exactly the improvement on the function itself but
This is a run of testdNormalization
Src% testdNormalize3 10000 19
Testing time for 10000 iterations.
First time = 0.330270 <==== Original version
First time = 00:00:00
Second time = 0.303506 <==== Improved version
Second time = 00:00:00
Third time = 0.329301
Third time = 00:00:00
Fourth time = 0.321214
Fourth time = 00:00:00
Normalize1=[ 0.937635, -0.002630, 0.347611] <== used to check if the
value are the same
Normalize2=[ 0.937635, -0.002630, 0.347611]
Normalize3=[ 0.937635, -0.002630, 0.347611]
Normalize4=[ 0.937635, -0.002630, 0.347611]
The value here is 8% of improvement
Remi
So, I would not trust the performance tools and suggest you making a test
program with random data (as I mentioned in previous letters) and trying it
with old and new functions on several machines.
I personally have access to Windows/x86&x64, MacOS/PowerPC, SunOS/Sparc,
Linux/Amd x64, AIX/???
I can try it on all these platforms, but I have no time to implement test
cases.
Oleh Derevenko
-- ICQ: 36361783
Oleh Derevenko
-- ICQ: 36361783
----- Original Message -----
From: "Remi Ricard" <remi....@simlog.com>
To: <ode-...@googlegroups.com>
Sent: 7 квітня 2008 р. 18:13
Subject: [ode-users] Re: Recent commits
>
> What are Normalize33 and Normalize34?
>
Those are other versions of the function. I was comparing 3 different
versions with the original one.
> Could you please remove custom headers like "Timer.h" so that it could be
> compiled with other operating systems?
>
On my keyboard I have a delete key. I think you have the same key
somewhere on your keyboard. ;-)
(I think I saw too often the stupid joke "Hit Any key". ... I was
enable to resist).
After deleting the header you will have to remove all the t.Start() ,
StopAndClear() and format(..) and use your own timer variables or use a
profiling tool.
Remi