Bidirectional range dilemma
deadalnix
deadalnix at gmail.com
Sun Jan 13 07:55:46 PST 2013
On Sunday, 13 January 2013 at 15:49:13 UTC, Peter Alexander wrote:
> On Sunday, 13 January 2013 at 14:01:28 UTC, bearophile wrote:
>> Safety on default and speed on request is one of the tenets of
>> D language. And it's a good thing.
>>
>> Not allocating a buffer for each permutation is premature
>> optimization.
>
> You may have convinced me. I'll need to think more about it.
>
> FWIW, it is not a premature optimisation. On a simple benchmark
> I did, adding .dup to front() increased runtime by 3.5x on DMD
> with all optimisations. 3.5 is the difference between C and
> Javascript in the Computer Language Benchmarks Game.
>
> http://benchmarksgame.alioth.debian.org/u32/which-programs-are-fastest.php
>
> I do care about safety, but I also believe that performance is
> critically important to D's success. Performance on demands is
> good in theory, but if I'm writing high performance code then I
> want performance by default, and I don't want to have to fill
> my code with annotations and special flags/options.
>
> I think we need a D mission statement that we can refer to, to
> settle these disputes. How much performance loss is acceptable
> in the name of safety by default?
You spend most of the time in the same piece of code. That one
must be annotated and everything, but most code could be written
in javascript running in a VM written in PHP that it would change
much.
Plus, you probably here are benchmarking mostly the GC, which is
known to be inefficient in D.
More information about the Digitalmars-d
mailing list