Array append performance revisited

dsimcha dsimcha at yahoo.com
Tue Sep 30 16:02:23 PDT 2008


A while back, there were some discussions about capacity fields, etc. on this
forum.  I was looking at the GC implementation, and, if we want to speed up
array appends in a dead simple way without really much, I think we can gain a
lot by simply making the size cache in gcx.d thread-local in D2.  When
appending to arrays in multiple threads, not only is one paying for frequent
size cache lookups, but one is also having all of their threads block on this
synchronization.

We have:

struct Gcx {
    void *p_cache;
    size_t size_cache;
}

Would it help to just make these two variables thread-local?



More information about the Digitalmars-d mailing list