[GHC] #7674: Separate StablePtr table from StableName table.

#7674: Separate StablePtr table from StableName table. -----------------------------+---------------------------------------------- Reporter: EyalLotem | Owner: EyalLotem Type: task | Status: new Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Currently, there is one table for these two difference concepts which makes each one of them less efficient. The patches that address this improve some benchmarks' performance by a factor of ~3. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -----------------------------+---------------------------------------------- Reporter: EyalLotem | Owner: EyalLotem Type: task | Status: patch Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Changes (by EyalLotem): * status: new => patch Comment: The benchmark is the small_hash_hs FFI binding to the small_hash library. They're at: https://github.com/Peaker/small_hash https://github.com/Peaker/small_hash_hs (To build the latter, you need to clone the former directly inside it). If you run small_hash_hs, it's runtime will be dominated by GC's, because of #7670. (~8 sec on my machine). However, if you set the min heap size to 200M (via "+RTS -H200M"), the run time becomes dominated by the stable ptr hash table/etc. To run the benchmark on ordinary GHC, you need to use small_hash_hs's "unpatched_ghc" branch. Patches at: https://github.com/Peaker/ghc/commits/separate_stable_tables On my hardware: Before patch After patch Hash insertion time 2.4 0.8 Total time 3.8 1.2 Hash insertion time 2.9 1.2 (-threaded) Total time 4.8 1.6 (-threaded) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -----------------------------+---------------------------------------------- Reporter: EyalLotem | Owner: EyalLotem Type: task | Status: patch Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by EyalLotem): || || Before patch || After patch || ||Hash insertion time|| 2.4 || 0.8 || || Total time || 3.8 || 1.2 || || Hash insertion time (-threaded) || 2.9 || 1.2 || || Total time (-threaded) || 4.8 || 1.6 || -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -----------------------------+---------------------------------------------- Reporter: EyalLotem | Owner: EyalLotem Type: task | Status: patch Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by EyalLotem): Also ran the benchmark without the specified heap size: || || unpatched || patched || ||-threaded, no heap size || 24.5s || 10.1 || ||no heap size || 23.1s || 8.3s || -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -----------------------------+---------------------------------------------- Reporter: EyalLotem | Owner: EyalLotem Type: task | Status: patch Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by EyalLotem): As an interesting reference point, this benchmark is doing 10 million insertions of unboxed ints to boxed ints and then destruction of the hash table. The small_hash benchmark, which inserts 10 million unboxed ints to unboxed ints takes 0.39sec. It does bulk allocations of the hash nodes, which is hard to do in the FFI binding because the allocation happens in general-purpose code, so it should support releasing back memory. The 1.2 sec is about a factor of 3 of overhead which may be reasonable given the extra indirection due to stable ptrs, the int boxing and the more fine-grained allocation. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -----------------------------+---------------------------------------------- Reporter: EyalLotem | Owner: Type: task | Status: patch Priority: normal | Component: Runtime System Version: 7.6.2 | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Changes (by EyalLotem): * owner: EyalLotem => -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -------------------------------------------------------+-------------------- Reporter: EyalLotem | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: Runtime System | Version: 7.6.2 Keywords: rts stable_ptr stable_name performance | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------------------------------+-------------------- Changes (by simonmar): * difficulty: => Unknown Comment: I'm afraid something is broken with `StableName`s in your patch: test `memo001` in `libraries/base` fails for me (this is a stress test for `StableName`s, it isn't run by default in validate, but it should be). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -------------------------------+-------------------------------------------- Reporter: EyalLotem | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.6.2 Resolution: | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by simonmar): * status: patch => new -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -------------------------------+-------------------------------------------- Reporter: EyalLotem | Owner: Type: task | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.6.2 Resolution: | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by EyalLotem): * cc: eyal.lotem@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -------------------------------+-------------------------------------------- Reporter: EyalLotem | Owner: Type: task | Status: patch Priority: normal | Milestone: Component: Runtime System | Version: 7.6.2 Resolution: | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by EyalLotem): * status: new => patch Comment: I replaced all 7 patches with "StableTables.patch", it is more manageable. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table.
-------------------------------+--------------------------------------------
Reporter: EyalLotem | Owner:
Type: task | Status: patch
Priority: normal | Milestone:
Component: Runtime System | Version: 7.6.2
Resolution: | Keywords: rts stable_ptr stable_name performance
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
-------------------------------+--------------------------------------------
Comment(by marlowsd@…):
commit 7e7a4e4d7e9e84b2c57d3d55e372e738b5f8dbf5
{{{
Author: Simon Marlow

#7674: Separate StablePtr table from StableName table. -------------------------------+-------------------------------------------- Reporter: EyalLotem | Owner: Type: task | Status: closed Priority: normal | Milestone: Component: Runtime System | Version: 7.6.2 Resolution: fixed | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by simonmar): * status: patch => closed * resolution: => fixed -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7674: Separate StablePtr table from StableName table. -------------------------------+-------------------------------------------- Reporter: EyalLotem | Owner: Type: task | Status: closed Priority: normal | Milestone: 7.8.1 Component: Runtime System | Version: 7.6.2 Resolution: fixed | Keywords: rts stable_ptr stable_name performance Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+-------------------------------------------- Changes (by simonmar): * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7674#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC