Re: [Algorithms] C style math libraries versus "proper" C++ maths
"Richard Fabian" <[email protected]> Sun, 26 Mar 2006 13:34:28 +0100
| Newsgroups | gmane.games.devel.general |
|---|---|
| Message-ID | <[email protected]> |
> Regarding profiling, you need to be very careful to get reliable profiling > numbers. For instance data/code alignment, cache warmups (i.e. the first > test read data over the bus while next one has advantage of reading it from > cache), systematicly executed background tasks while testing (e.g. some HD > activity occuring by OS always after 1sec of testing), etc. can easily cause > 5% performance difference between tests. Also make sure you profile in fully > optimized release version and disable C++ exception handling as it can > potentially hinder some of the inlining and result in other overheads. > > Jarkko > I agree that profiling is difficult to get right normally, but i think my method is safe: 1. write the test as a framework with the timing stuff built in. 2. write the implementation of the test as two seperate modules, one using one technique, the other using the other technique 3. test the apps one after the other giving them a few runs then giving the other a few runs, store all the runs sub timings. this gives me a good idea about what i can expect as best performance, worst performance, and the average case too. oddly, i found that the C++ version of the math library has a smaller standard deviation on the overall time to complete the excercise than the C style lib, I guess i'll put that down to there being more instructions made from the C++ version, but less access to memory... so, i'm not holding my breath for fantastic performance on PS2 where number of instructions being sent to the CPU is important still.