Loop optimization

Walter Bright newshound1 at digitalmars.com
Mon May 17 11:06:20 PDT 2010


bearophile wrote:
> So I have added an extra "unsafe floating point" optimization:
> 
> ldc -O3 -release -inline -enable-unsafe-fp-math -output-s test

In my view, such switches are bad news, because:

1. very few people understand the issues regarding wrong floating point 
optimizations

2. even those that do, are faced with a switch that doesn't really define what 
unsafe fp optimizations it is doing, so there's no way to tell how it affects 
their code

3. the behavior of such a switch may change over time, breaking one's carefully 
written code

4. most of those optimizations can be done by hand if you want to, meaning that 
then their behavior will be reliable, portable and correct for your application

5. in my experience with such switches, almost nobody uses them, and the few 
that do use them wrongly

6. they add clutter, complexity, confusion and errors to the documentation

7. they use it, their code doesn't work correctly, they blame the 
compiler/language and waste the time of the tech support people


More information about the Digitalmars-d-learn mailing list