ASM vs. C++

Started by
1 comment, last by Sr_Guapo 18 years, 8 months ago
Im currently (when I have time) dabbling with some inline assembly. I was just wondering what are the best ways to see how much of a speed boost I am getting with what im writing with ASM? For instance i wrote a factorial function in C++ and then one in ASM whats the best way to compare the 2? Another thing I was wondering is, is it ok to use inline assembly for templatized classes? Say for instance I had a cVector3<Number> class, can i then write ASM code for all the methods inside the class without worrying about the various types that the template class could be used for? Cheers in advance, :)
Steven ToveySPUify | Twitter
Advertisement
jan wrote a nice overview article on timing here :
Timing Pitfalls and Solutions

Quote:
can i then write ASM code for all the methods inside the class without worrying about the various types that the template class could be used for

depends. probably not.
For 99.9% of what you are doing, I am going to guess that ASM won't help considerably.

A good way to compare is to set up a loop performing each of the function x numvber of times. Ideally you want it to last a few seconds to get some good seperation if they are pretty close, maybe 10 to be safe.

You can start a timer right before the loop calling the c++ function and se how long it takes to complete. Then start the timer again to see how long it takes to loop through the ASM code.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute

This topic is closed to new replies.

Advertisement