asm optimization... does it worth?

Started by
12 comments, last by dodheim 18 years, 4 months ago
Yes, you can easily beat the compiler since they (except perhaps VectorC) are still poor at generating at SIMD code.
It's sometimes possible to get decent results by taking the compiler by the hand and leading it to the output you want, but it's often less frustrating to just write the assembly code yourself. And even then modern compiler's seem unable to generate many of the more complex instructions and bithacks.
Oh, and intrinsics are pretty much a joke, hopefully that'll change soon however.

Whether the optimization is worth the effort is another matter entirely.
Advertisement
Quote:Original post by Samurai Jack
Does AMD Code analyst require an AMD procesor like Intel's VTune?


From the information on AMD's site, I conclude it runs on non-AMD CPUs, however with limited functionality.
Timer-based profiling (periodic checking of EIP) works on all CPUs, wheras event-based profiling and pipeline simulation requires AMD CPU features.
Depending on what compiler you use
you can get various results using the "extra" cpu features.

The Intel compiler beat my use of MMX for Visual C++ 6.0 by 35%,
but even without the use of MMX, the performance was significantly higher with Intel. I do not know what the numbers are compared to the 2003/2005 editions of the Visual Studio, but I'd expect them to be less impressive.

As to the ASM optimisation, don't waste time if you don't really really need to.
Profile the app. and if the main loop looks too slow, then that is a good place to put ASM optimisations. Compilers cannot eventually beat good human ASM coding, because humans can optimize with the algorithm in mind, they are not restricted at recombining several groups of instructions. Also, standard c/c++ optimisation practices like loop unrolling and such are more than enough for most cases.

Hope this helps.
Thanks for your replies!

Btw nice to hear how many tools are out there for profiling ;)

This topic is closed to new replies.

Advertisement