Bidirectional range dilemma
Peter Alexander
peter.alexander.au at gmail.com
Sun Jan 13 07:49:12 PST 2013
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?
More information about the Digitalmars-d
mailing list