Performance of ranges verses direct

Marco Leise Marco.Leise at gmx.de
Wed Dec 11 02:42:24 PST 2013


Am Wed, 11 Dec 2013 08:29:38 +0100
schrieb "Frustrated" <c1514843 at drdrb.com>:

> 
> Has anyone done any work on comparing the performance of ranges 
> vs using direct straightforward code(optimized in the sense of 
> the way ranges work but by hand).
> 
> e.g., How does filter compare to a simple loop over the elements 
> and comparing it. How does a a chain of UFCS compare to doing the 
> same in a simple loop.

Just use hand written loops if you are worried about this or
benchmark on a per case basis. There is no one fits all answer.
Not all code executes a million times per second though, so
feel free to use them now and then where concise code is
regarded higher than premature optimization. ;)

-- 
Marco


More information about the Digitalmars-d-learn mailing list