Maintain per-generation lists of weak pointers
|Reported by:||akio||Owned by:|
|Type of failure:||Compile-time performance bug||Test Case:|
|Related Tickets:||Differential Revisions:|
Currently the runtime system keeps a list of all live weak pointers, and traverses it once every (major or minor) GC. This is very slow if the program keeps many weak pointers alive. Some comments in the rts source suggest that it should be using one weak pointer list per generation, so these patches implement that.
The attached test program tries to imitate the memory behavior of code that uses a particular FRP library. The patches make the program 3x faster on my machine.
One problem I can see with the patches is that it creates a race condition between finalizeForeignPtr and addForeignPtrFinalizer. I'm not even sure what the correct behavior is when addForeignPtrFinalizer is called after finalizerForeinPtr.
Change History (19)
Changed 23 months ago by akio
Changed 22 months ago by akio
comment:9 follow-up: ↓ 10 Changed 21 months ago by simonmar
- difficulty set to Unknown
- Status changed from patch to infoneeded