#3076: Make genericLength tail-recursive so it doesn't overflow stack
-----------------------------------------+----------------------------------
Reporter: Syzygies | Owner:
Type: run-time performance bug | Status: reopened
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: genericLength | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
-----------------------------------------+----------------------------------
Comment (by Syzygies):
I ran a timing test, to compare intLengthN for N=1,2,3 on an example that
N=1 (the existing library code) could handle:
{{{
print $ sum $ map intLength1 $ take 1000 $ iterate tail $ list $ 2^18
}}}
intLength3 runs slower (of course) than the invalid intLength2, but 5.5x
faster than the current library code intlength1.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3076#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs