Opened 8 years ago

#39 new enhancement

cannot reproduce run time optimization?

Reported by: dneise Owned by: somebody
Priority: major Milestone: milestone:milestone1
Component: component1 Version:
Keywords: Cc:

Description

While reviewing the drs calibration in Mars, I found some for loops which were optimized for runtime, to gain a factor of 250% in runtime. That's impressive.

An example can be seen here:
https://trac.fact-project.org/browser/trunk/Mars/mcore/DrsCalib.h#L52

One can find the original code in a multiline comment above the optimized version.

I originally wanted to verify that the optimized version really does the same as the un-optimized version, as I was to stupid to understand it, I simply let both versions do the same and compared the outcome.

It really did the same ... that's good. However I noticed no performance gain.
The compiler optimized both versions to run in roughly the same time. When switching compiler optimization off, I saw quite some gain in runtime, but we are not running our FACT++ code without compiler optimization, do we?

~/fact/Mars/mcore:$ make
g++ forloop_optim.cpp -o forloop_optim && ./forloop_optim
AddRel_simple took 11.969504 s.
AddRel_complex took 5.202990 s.
g++ -O2 forloop_optim.cpp -o forloop_optim && ./forloop_optim
AddRel_simple took 4.952487 s.
AddRel_complex took 4.896322 s.

I will try to attach the code and the makefile I used to test this.

Can you tell me, why I am not seeing the performance boost mentioned in the comment?

Attachments (2)

forloop_optim.cpp (2.8 KB ) - added by dneise 8 years ago.
Makefile (128 bytes ) - added by dneise 8 years ago.

Download all attachments as: .zip

Change History (2)

by dneise, 8 years ago

Attachment: forloop_optim.cpp added

by dneise, 8 years ago

Attachment: Makefile added
Note: See TracTickets for help on using tickets.