Re: operation timing

Re: operation timing

This sort of thing is pretty difficult to answer precisely, I think your numbers give you a general idea, however other effects of optimization may still have an effect, depending upon how your code is structured. Obviously if you write code that the compiler determines is unnecessary, as in the case of your benchmark, that will change things substantially. If you are working with arrays that exceed your working set size, then again, this may "equalize" things a bit. Ultimately what you are shooting for is to write things as efficiently as you can, then use a profiling tool to see where the fat is for further improvements. There likely will be some hardware dependence as well for these relative timings.

One minor note, your EXP appears to be quite a bit more efficient relative to addition than on my setup.


4 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

I'll comment that in some cases, optimized code can use hardware instructions for these operations, rather than the library calls you'll get in an unoptimized configuration. Also, optimization can reorder the expressions and may do a different series of operations than you have written in the code.

My general advice on such matters is to not try to code to a view of "which operations are fastest". Write the code in a natural fashion and allow the compiler to do its job. If you think performance needs to be improved, run a profiler to see where the hot spots are. Almost invariably, they aren't where you think.


Steve - Intel Developer Support

CVF could help us address such questions about op code timing if they would include an option in the assembly language listing files to show the number of clocks with each instruction. You can take the CVF assembly listing file and recompile it with MASM option /Sc to generate timings. Of course some of the conditional instructions take different times depending whether or not a jump is made.

Keep in mind that very optimized code is also very specific for compiler and CPU. Migrating to any other version of compiler or CPU means testing again. There is no convention or garantee how source wil be translated. DaVinci

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi