Good project: stride() with constant stride value

kinke via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 4 10:40:58 PST 2016


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.


More information about the Digitalmars-d mailing list