The acos, atan functions in stl use many processor cycles

I wanted to calculate the angle between the two vectors, but I saw that these inverse trigger operations, such as acos and atan, use many processor cycles. Is there a way I can perform this calculation without using these functions? Also, did this really affect you when optimizing?

+3
source share
4 answers

There are no such functions in STL; they are in the math library.

Also, are you sure it is important to be effective here? Have you profiled to see if there are features like this in hot spots? Did you know that performance is poor when using these features? You should always answer these questions before diving into such micro-optimizations.

To give advice, what are you going to do with it? How accurate is that?

, , , . , , . , acos. , , , , .

, , , , , , - .

+10

. , , , .

+2
+2

atan acos . , .

:

  • Application profile to find where most of the runtime spent.
  • Redesign this area for better performance.
  • Consider Data Driven Design methods to speed up your program.
  • Change the logic to reduce branches and if statements, carnot maps to simplify the logic.
+1
source

Source: https://habr.com/ru/post/1748052/


All Articles