Simple performance question from a newcomer

dextorious via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 23 12:12:10 PST 2016


On Tuesday, 23 February 2016 at 14:07:22 UTC, Marc Schütz wrote:
> On Tuesday, 23 February 2016 at 11:10:40 UTC, ixid wrote:
>> We really need to standard algorithms to be fast and perhaps 
>> have separate ones for perfect technical accuracy.
>>
>
> While I agree with most of what you're saying, I don't think we 
> should prioritize performance over accuracy or correctness. 
> Especially for numerics people, precision is very important, 
> and it can make a just as bad first impression if we don't get 
> this right. We can however make the note in the documentation 
> (which already talks about performance) a bit more prominent: 
> http://dlang.org/phobos/std_algorithm_iteration.html#sum

Being new to the language, I certainly make no claims about what 
the Phobos library should do, but coming from a heavy numerics 
background in many languages, I can say that this is the first 
time I've seen a common summation function do anything beyond 
naive summation. Some languages feature more accurate options 
separately, but never as the default, so it did not occur to me 
to specifically check the documentation for something like sum() 
(which is my fault, of course, no issues there). Having the more 
accurate pairwise summation algorithm in the standard library is 
certainly worthwhile for some applications, but I was a bit 
surprised to see it as the default.


More information about the Digitalmars-d-learn mailing list