ASM vs. C++
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, :)
jan wrote a nice overview article on timing here :
Timing Pitfalls and Solutions
depends. probably not.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement