Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus| Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 6.12 branch Component: Compiler |Version: 6.6 Resolution: | Keywords: Difficulty: Unknown | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Runtime performance bug | --+- Changes (by guest): * cc: sve...@gmail.com (added) Comment: Problem still exists on 6.12-rc2 The memory leak appears to have gone away again, but there's a factor of two difference in speed between the two versions of the code. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus| Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 6.12 branch Component: Compiler |Version: 6.6 Resolution: | Keywords: Difficulty: Unknown | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Runtime performance bug | --+- Changes (by igloo): * milestone: 6.12.1 = 6.12 branch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus| Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 6.12.1 Component: Compiler |Version: 6.6 Resolution: | Keywords: Difficulty: Unknown | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Runtime performance bug | --+- Changes (by daniel.is.fischer): * cc: daniel.is.fisc...@web.de (added) Comment: Still slow and also overallocating in 6.10.3: {{{ ./indexL 10 +RTS -sstderr array (1,40) [snip] 7,132,475,396 bytes allocated in the heap 935,808 bytes copied during GC 31,748 bytes maximum residency (1 sample(s)) 22,992 bytes maximum slop 1 MB total memory in use (0 MB lost due to fragmentation) Generation 0: 13604 collections, 0 parallel, 0.20s, 0.16s elapsed Generation 1: 1 collections, 0 parallel, 0.00s, 0.00s elapsed INIT time0.00s ( 0.00s elapsed) MUT time 11.34s ( 11.42s elapsed) GCtime0.20s ( 0.16s elapsed) EXIT time0.00s ( 0.00s elapsed) Total time 11.55s ( 11.58s elapsed) %GC time 1.8% (1.4% elapsed) Alloc rate628,705,232 bytes per MUT second Productivity 98.2% of total user, 97.9% of total elapsed da...@linux-mkk1:~/Haskell/CafeTesting ./indexH +RTS -sstderr -RTS 10 ./indexH 10 +RTS -sstderr array (1,40) [snip] 9,800,880 bytes allocated in the heap 11,908 bytes copied during GC 31,696 bytes maximum residency (1 sample(s)) 22,992 bytes maximum slop 1 MB total memory in use (0 MB lost due to fragmentation) Generation 0:18 collections, 0 parallel, 0.00s, 0.00s elapsed Generation 1: 1 collections, 0 parallel, 0.00s, 0.00s elapsed INIT time0.00s ( 0.00s elapsed) MUT time3.80s ( 3.80s elapsed) GCtime0.00s ( 0.00s elapsed) EXIT time0.00s ( 0.00s elapsed) Total time3.80s ( 3.80s elapsed) %GC time 0.0% (0.0% elapsed) Alloc rate2,581,735 bytes per MUT second Productivity 100.0% of total user, 100.0% of total elapsed }}} Both compiled with -O2. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? -+-- Reporter: claus |Owner: simonpj Type: run-time performance bug | Status: new Priority: normal|Milestone: 6.12.1 Component: Compiler | Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by igloo): * milestone: 6.10.2 = 6.12.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus | Owner: simonpj Type: run-time performance bug | Status: new Priority: normal| Milestone: 6.10.2 Component: Compiler |Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown/Multiple Os: Unknown/Multiple | --+- Changes (by igloo): * milestone: 6.10.1 = 6.10.2 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus | Owner: simonpj Type: run-time performance bug | Status: new Priority: normal| Milestone: 6.10.1 Component: Compiler |Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Changes (by igloo): * milestone: 6.8.3 = 6.10.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus | Owner: simonpj Type: run-time performance bug | Status: new Priority: normal| Milestone: 6.8.3 Component: Compiler |Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Changes (by simonmar): * type: bug = run-time performance bug -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus | Owner: simonpj Type: bug | Status: new Priority: normal| Milestone: 6.8.3 Component: Compiler |Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Comment (by simonpj): A Friday afternoon, so I thought I'd look at this. The problem is that `GHC.Arr.$windex1`, which is called from the inner loop has this inlining: {{{ $windex1 :: GHC.Prim.Int# - GHC.Prim.Int# - GHC.Prim.Int# - GHC.Base.Int {- Arity: 3 Strictness: LLL Unfolding: (\ ww :: GHC.Prim.Int# ww1 :: GHC.Prim.Int# ww2 :: GHC.Prim.Int# - case @ GHC.Base.Int GHC.Prim.=# ww ww2 of wild { GHC.Base.False - GHC.Arr.indexError2 (GHC.Base.I# ww, GHC.Base.I# ww1) (GHC.Base.I# ww2) GHC.Arr.lvl3 GHC.Base.True - case @ GHC.Base.Int GHC.Prim.=# ww2 ww1 of wild1 { GHC.Base.False - GHC.Arr.indexError2 (GHC.Base.I# ww, GHC.Base.I# ww1) (GHC.Base.I# ww2) GHC.Arr.lvl3 GHC.Base.True - GHC.Base.I# (GHC.Prim.-# ww2 ww) } }) -} }}} Note the allocation of the `I#` box! Why? Becuase `GHC.Arr.indexError` is not marked as a bottoming function. Why not? Because it looks like this: {{{ [Arity 1 Str: DmdType L] GHC.Arr.indexError = \ (@ a_aRh) (@ b_aRi) ($dShow_aRD [ALWAYS Just L] :: GHC.Show.Show a_aRh) - let { shows1_X1Am [ALWAYS Just L] :: a_aRh - GHC.Show.ShowS [Str: DmdType {aRD-U(C(S)AA)}] shows1_X1Am = GHC.Show.shows @ a_aRh $dShow_aRD } in let { shows2_X1Ap [ALWAYS Just L] :: a_aRh - GHC.Show.ShowS [Str: DmdType {aRD-U(C(S)AA)}] shows2_X1Ap = GHC.Show.shows @ a_aRh $dShow_aRD } in \ (rng_ah3 [ALWAYS Just L] :: (a_aRh, a_aRh)) (i_ah5 [ALWAYS Just L] :: a_aRh) (tp_ah7 [ALWAYS Just S] :: GHC.Base.String) - GHC.Err.error @ b_aRi (...stuff...) }}} Note the stupid arity and that the strictness analyser is not spotting the bottom result. I'll think about how to fix this stupidity. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus | Owner: simonpj Type: bug | Status: new Priority: normal| Milestone: 6.8.3 Component: Compiler |Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Changes (by simonmar): * milestone: 6.8 branch = 6.8.3 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? -+-- Reporter: claus |Owner: Type: bug | Status: new Priority: normal|Milestone: 6.6.2 Component: Compiler | Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Os: Unknown | Testcase: Architecture: Unknown | -+-- Changes (by guest): * cc: [EMAIL PROTECTED] = [EMAIL PROTECTED] [EMAIL PROTECTED] -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? --+- Reporter: claus | Owner: Type: bug | Status: new Priority: normal| Milestone: 6.6.2 Component: Compiler |Version: 6.6 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Architecture: Unknown Os: Unknown | --+- Changes (by igloo): * milestone: = 6.6.2 Comment: We should look into this for 6.6.2. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #1216: indexing 2d arrays is slow and leaky. why?
#1216: indexing 2d arrays is slow and leaky. why? -+-- Reporter: claus | Owner: Type: bug | Status: new Priority: normal| Milestone: Component: Compiler | Version: 6.6 Severity: normal|Keywords: Difficulty: Unknown |Testcase: Architecture: Unknown | Os: Unknown -+-- readArray/writeArray call GHC.Arr.index, which seems inexplicably slow for 2d arrays. inexplicably, because simply copying the default implementation of index from GHC.Arr into the local module can speed things up considerably. originally raised in this thread: http://www.haskell.org/pipermail/haskell-cafe/2007-March/023394.html shortened example or matrix/vector-multiplication attached. comment out the first line of myindex to use the local copy. this results in a speedup from 20s to 13s (time ./Index 10) on my system, not to mention the difference in space usage (a factor of 1000 in allocation, according to +RTS -sstderr..). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1216 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs