Enhanced array appending

Steven Schveighoffer schveiguy at yahoo.com
Wed Dec 23 05:44:03 PST 2009


grauzone Wrote:

> Steven Schveighoffer wrote:
> > All,
> > 
> > I created a new patched druntime that prevents array stomping and at the 
> > same time increases append performance for thread-local array appending.
> > 
> > The patch is attached to bugzilla entry 3637. ( 
> > http://d.puremagic.com/issues/show_bug.cgi?id=3637 )
> 
> Nobody cares about it? (Except someone commenting in bugzilla, but 
> where's Andrei and Walter?)

I have already discussed this patch with Andrei and Walter (and the rest of the compiler/phobos crew), they are on board.  I am a little disappointed with the response here, but I guess it could be attributed to the barrier to experimentation (you have to apply the patch and compile the runtime) and the likelihood that many are on vacation right now (as I will be as of tonight).

> Also, what again were the arguments against adding a "capacity" field in 
> the slice struct to deal with the append problem?

The problem is that adding a capacity field only works if the object is a reference type.  A value type will make either choose to make copies of the capacity field, resulting in the same stomping problem (and maybe worse), or will zero out one of the copy's capacity field, resulting in an artificial limitation for appending.  The only true way to make this work right is to have a capacity field shared among all the aliases to the same data, and the most logical place for that is in the allocated block.

-Steve



More information about the Digitalmars-d mailing list