Maintain per-generation lists of weak pointers
|Reported by:||akio||Owned by:|
|Type of failure:||Compile-time performance bug||Test Case:|
|Related Tickets:||Differential Rev(s):|
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)
comment:9 follow-up: ↓ 10 Changed 3 years ago by simonmar
- difficulty set to Unknown
- Status changed from patch to infoneeded