Performance comparison benchmark for cpp performance comparison

We are developing a real-time system that will perform sin / cos calculations during a critical period of work. We plan to use a lookup table to help with performance, and I'm trying to compare the benefits / costs of implementing a table. Unfortunately, we still do not know what degree of accuracy we will need, but probably around 5-6 decimal points.

I believe that an end-to-end comparison of trigger functions of C ++ search approaches has already been done previously. I was hoping that someone could provide me with a link to a site documenting any such benchmarking. If such results do not exist, I would appreciate any suggestions on how I can determine how much memory is required for the lookup table with minimal accuracy and how I can determine the potential benefit.

Thank!

+3
source share
3 answers

, , , . , , .

+2

( , "" ). ? ? , .

, , ( w/two - / ).

SIN 0,00 90,00 9001 32- .

SIN [0] = 0.0 ... SIN [4500] = 0,7071068 ... SIN [9000] = 1.0

SIN, trig COS (a) = SIN (90-a) , SIN [9000-] COS (a)

, , , . SIN 45.00123

SIN [4500] + 0,123 * (SIN [4501] - SIN [4500])

+1

- .

, , , , , , .

, , , - . (Intel AMD PDF , )

, , , , , , .

But this only gives a rough estimate of one side of the equation. Perhaps you can make a similar rough estimate of the cost of the lookup table if you know the latency of the CPU caches, and you have an approximate idea of ​​the latency of memory access.

But the only way to get accurate information is to try. Add both of these and see what happens in your application. Only then will you know what is best in your case.

0
source

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


All Articles