Performance of tables slower than built in?
Alex
AJ at gmail.com
Thu May 23 10:21:22 UTC 2019
On Wednesday, 22 May 2019 at 00:55:37 UTC, Adam D. Ruppe wrote:
> On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote:
>> I am trying to create some fast sin, sinc, and exponential
>> routines to speed up some code by using tables... but it seems
>> it's slower than the function itself?!?
>
> There's intrinsic cpu instructions for some of those that can
> do the math faster than waiting on memory access.
>
> It is quite likely calculating it is actually faster. Even
> carefully written and optimized tables tend to just have a very
> small win relative to the cpu nowadays.
Surely not? I'm not sure what method is used to calculate them
and maybe a table method is used internally for the common
functions(maybe the periodic ones) but memory access surely is
faster than multiplying doubles?
And most of the time these functions are computed by some series
that requires many terms. I'd expect, say, to compute sin one
would require at least 10 multiplies for any accuracy... and
surely that is much slower than simply accessing a table(it's
true that my code is more complex due to the modulos and maybe
that is eating up the diff).
Do you have any proof of your claims? Like a paper that discusses
such things so I can see what's really going on and how they
achieve such performance(and how accurate)?
More information about the Digitalmars-d-learn
mailing list