Good project: stride() with constant stride value

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 4 13:19:40 PST 2016


On Fri, Mar 04, 2016 at 08:14:41PM +0000, Andrei Alexandrescu via Digitalmars-d wrote:
> 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

Why not rather improve dmd optimization, so that such manual
optimizations are no longer necessary?


T

-- 
English has the lovely word "defenestrate", meaning "to execute by throwing someone out a window", or more recently "to remove Windows from a computer and replace it with something useful". :-) -- John Cowan


More information about the Digitalmars-d mailing list