Jump to content


- - - - -

Math Assembly


2 replies to this topic

#1 _NOISEcore

    Member

  • Members
  • PipPip
  • 31 posts

Posted 27 August 2011 - 07:32 PM

Hi there,

I have been working on my own "engine" for a while now,
and I believe that it is time that I start optimizing my mathematics
through assembly. I have already optimized some mathematical functions,
but not through assembly.

The question I have however,
is where can I find some descent information about integrating
assembly into C++.

I already looked around a bit, but I didn't find anything that explained it descently (How does it work, how do the registers work, etc..)

I thank you in advance..

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 5340 posts
  • LocationSanta Clara, CA

Posted 27 August 2011 - 07:55 PM

You almost certainly don't need to write actual assembly. If you want to use SIMD or other architecture-specific features, there are intrinsics available, which translate directly to specific hardware instructions but allow you to keep using C++ syntax (and all the other benefits of automated code generation). For example, here is the Intel x86 intrinsics reference (MMX, SSE 1-4, a few other things).

Moreover, optimizing algorithms and data layout (cache locality) are almost certainly going to be more effective than optimizing at the instruction level. If you want to improve your engine's performance, those would be the place to start. Be sure to profile your engine to actually measure what's taking the most time, so you can make intelligent optimization decisions based on real numbers rather than assumptions!
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 _NOISEcore

    Member

  • Members
  • PipPip
  • 31 posts

Posted 27 August 2011 - 10:47 PM

Thank you, I will surely look into that.
I have heard of those, and they sure seem interesting.

At the moment, it is mostly matrix transformations that take up
quite a lot (relative of course) of time. Maybe this will help.
Thank you for the info.

EDIT: Also, on a side note. This "engine" isn't being written as use of an actual engine,
see it more as a little project on which I work to test and expand my knowledge of programming.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users