On Friday, 24 May 2019 at 13:57:30 UTC, Ola Fosheim Grøstad wrote:
On Friday, 24 May 2019 at 12:24:02 UTC, Alex wrote:
If it truly is a 27x faster then then that is very relevant and knowing why is important.

Of course, a lot of that might simply be due to LDC and I wasn't able to determine this.

Just one more thing you really ought to consider:

It isn't obvious that a LUT using double will be more precise than computing sin using single precision float.

So when I use single precision float with ldc and "-O3 -ffast-math" then I get roughly 300ms. So in that case the LUT is only 3 times faster.

Perhaps not worth it then. You might as well just use float instead of double.

The downside is that -ffast-math makes all your computations more inaccurate.

It is also possible that recent processors can do multiple sin/cos as simd.

Too many options… I know.

The thing is, the LUT can have as much precision as one wants. One could even spend several days calculating it then loading it from disk.

I'm not sure what the real precision of the build in functions are but it shouldn't be hard to max out a double using standard methods(even if slow, but irrelevant after the LUT has been created).

Right now I'm just using the built ins... Maybe later I'll get back around to all this and make some progress.

Reply via email to