value range propagation for _bitwise_ OR

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 13 10:51:10 PDT 2010


On Tue, 13 Apr 2010 13:37:13 -0400, Jérôme M. Berger <jeberger at free.fr>  
wrote:

> Steven Schveighoffer wrote:
>> Jérôme M. Berger Wrote:
>>
>>> Steven Schveighoffer wrote:
>>>> When we're talking about the difference between O(1) and O(lgn), I'll
>>>> take accuracy over speed in my compiler any day.
>>> 	And when we're talking about the difference between 10s and 55s for
>>> a minimal loss of accuracy, which will you take? Especially if the
>>> accuracy loss is less than is lost elsewhere (due to holes in the
>>> ranges).
>>
>> Really?  You rebuilt the compiler with your range propagation algorithm  
>> and verified that it adds 10 seconds versus an accurate one that adds  
>> 55s?  How much time did the compiler spend to compile?  I'd hazard to  
>> guess that a code base that adds 10s worth of your algorithm takes at  
>> least a few hours to compile.  Is 55s that bad at that point?
>>
>> Again, if it takes the compiler an extra insignificant amount of time  
>> to be more accurate, I'm all for accuracy over speed when you get down  
>> to that level of insignificance.  I'd say the point of pain has to be  
>> at least 10% of the compile time before it makes any sizable difference.
>>
> 	My point is that if you always choose an algorithm that is 5 to 6
> times slower just because it brings extra precision which you may
> not really need, then you will wind up with a compiler that is 5 to
> 6 times slower than it needs to be. Sure the difference on *one*
> function is not great in absolute terms, but if you make the same
> choice for *all* functions, then where do you go?

In my opinion?  Yes, slower compilers that make code easier to write are  
better.  I don't spend lots of time compiling, I spend it writing code.   
And I don't need to babysit the compiler, it goes off and does its thing.

Performance is only important in the end result.  I'm not saying I want my  
compiler to be slow, but I want it to be accurate and useful more than I  
want it to be quick.  In this case, there is a quick and fully accurate  
solution, so it doesn't matter.  But, for instance, if the compiler could  
do a full analysis to check if variables escape their scope, and that  
makes the compiler 5x slower, then I'd rather have the compiler verify my  
work instead of quickly producing memory-corrupting code.

-Steve



More information about the Digitalmars-d mailing list