On 03/22/2010 10:16 AM, Steve Schveighoffer wrote:
I don't think you understand the purpose of the cache. It does not
store arrays, it stores BlkInfo's. This is information from the GC
about where a memory block starts, its length, and what flags it was
created with. Appending in-place to an array does not change the
cached blockinfo.
Yes, but at the end of the day, you do have a primitive that tells you
whether a given array extends to the end of a given block and
consequently is ok to append to in-place. Correct?
First, setting length to be smaller already does what you propose,
except it does not look anything up in the cache.
You told me that for best results I need to do:
arr.length = 0;
arr.assumeSafeAppend();
The last call makes the system assume that I saved no subarray of arr
that I'm interested in keeping. No?
Second, slicing is a way way more common operation than setting the
length, and you would be changing this common operation that does 2
reads and 2 writes to a function call with a cache search. Any gain
you think you get from removing the block from the cache would be
overshadowed by the bloating of the slice operation itself.
I'd guess you and David are right.
Andrei
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos