Feature Req.+Patch: O(1) removeRange

downs default_357-line at yahoo.de
Wed Jun 25 09:10:16 PDT 2008


When working with coroutines, the many removeRange calls can cause significant slowdowns. This patch aims to address the problem.

It changes the Phobos GC's addRange to take an optional third parameter, a pointer to a size_t.
If this pointer is non-null, its target will contain the current position of the addedRange in the array of ranges.

When the array is reordered, for instance by removeRange, the moved ranges' indexes are updated.

The size_t can be passed to removeRange for O(1) range removal.

Normal removeRange has been changed to call index-based removeRange instead, as it is faster than memmove.

 --downs
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: phobos_gc_constant_time_removeRange.patch
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080625/0fdb93bc/attachment.ksh>


More information about the Digitalmars-d mailing list