[GHC] #12248: Simple program that runs 100x slower using Text or ByteString vs. String

#12248: Simple program that runs 100x slower using Text or ByteString vs. String -------------------------------------+------------------------------------- Reporter: dsf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Core | Version: 8.0.1 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Here is a repository that just contains a simple function slowText that takes a long list of String / Text / ByteString and appends them using a function based on what happens in the UnitLargeDoc test of the pretty package. A list of String with 10,000,000 elements can be processed in about 5 seconds on my machine. Lists that long blow the stack if the element type is Text or ByteString. For shorter lists, the element processing time is 100x longer or more. git repo: https://github.com/ddssff/slowtext travis output: https://travis-ci.org/ddssff/slowtext/builds The 7.10 and 8.0.2 tests are running properly and failing because the Text and ByteString tests take longer than String. I will fix the others shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12248 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12248: Simple program that runs 100x slower using Text or ByteString vs. String -------------------------------------+------------------------------------- Reporter: dsf | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Core Libraries | Version: 8.0.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => closed * resolution: => invalid Comment: Yes, because `String` is a linked list so you can efficiently prepend a short `String` to a long `String`, while (strict) `ByteString` and `Text` are flat arrays so prepending a short one to a long one requires copying the entire long one. Different data structures for different tasks! Anyways, bytestring and (especially) text are not part of GHC, and have their own issue trackers. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12248#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC