Good project: stride() with constant stride value
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Fri Mar 4 12:14:41 PST 2016
kinke <noone at nowhere.com> wrote:
> On Friday, 4 March 2016 at 17:49:09 UTC, John Colvin wrote:
>> Surely after inlining (I mean real inlining, not dmd) it makes
>> no difference, a constant is a constant?
>>
>> I remember doing tests of things like that and finding that not
>> only did it not make a difference to performance, ldc produced
>> near-identical asm either way.
>
> Then let's not complicate Phobos please. I'm really no friend of
> special semantics for `step == 0` and stuff like that. Let's keep
> code as readable and simple as possible, especially in the
> standard libraries, and let the compilers do their job at
> optimizing low-level stuff for release builds.
> More templates surely impact compilation speed, and that's where
> DMD shines.
>
This is just speculation. When the stride is passed to larger functions the
value of the stride is long lost.
I understand the desire for nice and simple code but sadly the stdlib is
not a good place for it - everything must be tightly optimized. The value
of the project stands. -- Andrei
More information about the Digitalmars-d
mailing list