[GD-General] Re: [Algorithms] C style math libraries versus "proper" C++ maths
Brought to you by:
vexxed72
From: Richard F. <ra...@de...> - 2006-03-26 12:34:31
|
> Regarding profiling, you need to be very careful to get reliable profilin= g > 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 fr= om > cache), systematicly executed background tasks while testing (e.g. some H= D > activity occuring by OS always after 1sec of testing), etc. can easily ca= use > 5% performance difference between tests. Also make sure you profile in fu= lly > 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, wors= t 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. |