Array append performance 2

bearophile bearophileHUGS at lycos.com
Sat Aug 30 18:58:29 PDT 2008


dsimcha:

>Nice work on the reference template.<

It comes from several expansion and compression cycles, has requires few hours to be written ;-)


>Also, to answer your question, you do need to call hasNoPointers() each time you realloc.<

Right, I have just read the D docs that say it.
But what's the rationale behind it? If I have a pointer and I want to realloc it, to make its space bigger, I never want to change the fact that the GC scans its pointers or not. Stating it once must suffice.


>Oh, one more thing:  What's a static struct as opposed to a regular struct?<

I have taken a look at the documentation, and I have performed some benchmarks, now I think it does nothing, I have removed that attribute.
I have flagged that struct fields as private because originally that was a class, but a struct is better and faster, so I have removed those "private" too.


>One small issue:  Your IsReference template doesn't work with invariant, and presumably const, types.<

Because I (as most people here, I presume) use D 1. Sorry for not stating it clearly.


> The easiest way to fix this is to add a Mutable!():
> static if (IsType!(Mutable!(Types[0]), bool, byte, [...]

Thank you, I have added a note into my libs, even if they are for D 1.

Hopefully some one else will tell me if the ArrayBuilder is correct (even if this group isn't D.learn).

Bye and thank you,
bearophile



More information about the Digitalmars-d mailing list