RFC on range design for D2

bearophile bearophileHUGS at lycos.com
Wed Sep 10 03:19:04 PDT 2008


Andrei Alexandrescu:

> Speaking of examples and readability, and to tie this with the 
> discussion on array reallocation, I was curious on an array appender 
> built on the output range interface. I've seen a quite complicated array 
> builder in digitalmars.d. I wanted a simpler appender that should not do 
> worse than the built-in ~= and that works with algorithm2 whenever data 
> is written out.

That builder was probably my one, designed for D1. For the last version take a look at the 'builder.d' module in the libs I have shown you. It's not too much complex: its API is simple and its internals are as complex as they have to be to be efficient. (I'm slowly improving it still, I'm now trying to make it more flexible, making its extending functionality work with other kinds of iterables too.)


> I'd be curious how it fares with other tests that you guys may have.

That module has about 380 lines of code of benchmarks (after few hundred of lines of unit tests), I think you can add few lines to them to benchmark your implementation, but I presume mine is more efficient :-) I may do few benchmarks later...

Bye,
bearophile


More information about the Digitalmars-d-announce mailing list