digitalmars.D - Feature Req.+Patch: O(1) removeRange
- downs (7/7) Jun 25 2008 When working with coroutines, the many removeRange calls can cause signi...
- downs (2/2) Jun 25 2008 I forgot to remove some experimental stuff.
- downs (3/3) Jun 25 2008 And I found another bug. Due to the small size of the patch, I'm optimis...
- downs (4/4) Jun 25 2008 Aaaand another one!
- Nick Sabalausky (4/9) Jun 25 2008 "I am beginning to lose trust in my ability to code straight."
- Jarrett Billingsley (4/9) Jun 25 2008 Downs I think it's neat!
- Tom S (6/8) Jun 28 2008 These look pretty useful; Bump! // ++votes;
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
Jun 25 2008
I forgot to remove some experimental stuff. Sorry for that.
Jun 25 2008
And I found another bug. Due to the small size of the patch, I'm optimistic that it's the last one. (I forgot to set the target pointer in addRange) Fixed patch attached.
Jun 25 2008
Aaaand another one! This time, it's a race condition. When two threads try to removeRange at the same time, the position of a Range might change before the lock is engaged. Fixed by passing the index by reference until inside the sync block.
Jun 25 2008
"downs" <default_357-line yahoo.de> wrote in message news:g3tud7$h3r$1 digitalmars.com...Aaaand another one! This time, it's a race condition. When two threads try to removeRange at the same time, the position of a Range might change before the lock is engaged. Fixed by passing the index by reference until inside the sync block."I am beginning to lose trust in my ability to code straight." Friends don't let friends drink and code ;)
Jun 25 2008
"downs" <default_357-line yahoo.de> wrote in message news:g3tud7$h3r$1 digitalmars.com...Aaaand another one! This time, it's a race condition. When two threads try to removeRange at the same time, the position of a Range might change before the lock is engaged. Fixed by passing the index by reference until inside the sync block.Downs I think it's neat! /me supports downs' delicate ego.
Jun 25 2008