[GHC] #10470: Allocating StablePtrs leads to GC slowdown even after they're freed

#10470: Allocating StablePtrs leads to GC slowdown even after they're freed -------------------------------------+------------------------------------- Reporter: bitonic | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 7.10.1 System | Operating System: Unknown/Multiple Keywords: | Type of failure: Runtime Architecture: | performance bug Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- If we allocate and then free a lot of StablePtrs the GC performance will be degrated for the rest of the execution. I have attached a program that performs a GC-heavy task (foldr'ing a long list of Ints) before and after allocating and then freeing a million StablePtrs. After the StablePtrs are freed the task takes more than twice as long. The reason for this is that {{stable_ptr_table}} in {{Stable.c}} is never resized, and is looped over for every GC pause. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10470 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10470: Allocating StablePtrs leads to GC slowdown even after they're freed -------------------------------------+------------------------------------- Reporter: bitonic | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Description changed by bitonic: Old description:
If we allocate and then free a lot of StablePtrs the GC performance will be degrated for the rest of the execution.
I have attached a program that performs a GC-heavy task (foldr'ing a long list of Ints) before and after allocating and then freeing a million StablePtrs. After the StablePtrs are freed the task takes more than twice as long.
The reason for this is that {{stable_ptr_table}} in {{Stable.c}} is never resized, and is looped over for every GC pause.
New description: If we allocate and then free a lot of StablePtrs the GC performance will be degrated for the rest of the execution. I have attached a program that performs a GC-heavy task (foldr'ing a long list of Ints) before and after allocating and then freeing a million StablePtrs. After the StablePtrs are freed the task takes more than twice as long. The reason for this is that `stable_ptr_table` in `Stable.c` is never resized, and is looped over for every GC pause. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10470#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10470: Allocating StablePtrs leads to GC slowdown even after they're freed -------------------------------------+------------------------------------- Reporter: bitonic | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): We can't fix this by trying to resize `stable_ptr_table`, however, because if we have a used stable pointer at location 0 and a used stable pointer at location n, we can't resize smaller than n. (We might be able to if we used a hash table, but that would hurt read performance.) So really we need to be more clever about how we traverse the static pointer table, maybe by linking live entries together or something more clever. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10470#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10470: Allocating StablePtrs leads to GC slowdown even after they're freed -------------------------------------+------------------------------------- Reporter: bitonic | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by bitonic): Yeah, I used "resize" in a fairly liberal way :). One quick improvement would be to at least free empty tails, which wouldn't require any trick to maintain the existing indexes. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10470#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC