Wrote a blog post about CTFE and D
Rene Zwanenburg
renezwanenburg at gmail.com
Fri Aug 31 18:46:34 PDT 2012
On Thursday, 30 August 2012 at 09:41:43 UTC, Danny Arends wrote:
> I wrote a blog post about the stuff I've been doing last
> weekend using CTFE.
> All comments are welcome, you can find the blog post at:
>
> http://www.dannyarends.nl/index.cgi?viewDetailed=00029
>
> Danny Arends
> http://www.dannyarends.nl
It's always good to see someone write about the unusual features
of D, but I have a non-D related point of criticism regarding
your post: lookup tables for trig functions are a thing from the
nineties.
I'm not trying to make some bad 'the nineties called' joke ;).
Since at least a decade, calling the trig functions will usually
be significantly faster in a real application than a lookup
table. Simple benchmarks may show a performance improvement, but
that's because the table still resides in the L1 cache. A real
application will often have to read the table from main memory,
which is orders of magnitude slower than simply doing the
computation.
Use caching for data which is really expensive to calculate. For
relatively trivial stuff like sin(), just calculate it during
runtime.
More information about the Digitalmars-d-announce
mailing list