[GHC] #9577: String literals are wasting space
GHC
ghc-devs at haskell.org
Sun Sep 14 21:38:56 UTC 2014
#9577: String literals are wasting space
-------------------------------------+-------------------------------------
Reporter: xnyhps | Owner: xnyhps
Type: bug | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.8.2
(NCG) | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: | Difficulty: Unknown
Unknown/Multiple | Blocked By:
Type of failure: Runtime | Related Tickets:
performance bug |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by dfeuer):
Replying to [comment:3 xnyhps]:
> The main argument in favor of alignment seems to be: code often
`memcpy`s string literals into buffers. By doing that with aligned
addresses (apparently) SSE instructions can be used. This is irrelevant
for GHC, because the strings are only parsed into `[Char]`s, never copied.
Will that always be the case if a string literal represents something like
`Text` or `ByteString`? If so, will that continue to hold in the future?
Might a future optimization fuse `putStr` with the conversion to do a
copy? It may be that these concerns are baseless, but it might make sense
to consider what alternative optimizations yours could preclude.
You mention that there are a lot of string literals in the Prelude. I
would bet that the vast majority of those are error messages. Might it be
possible to specifically target ''exceptional'' strings that should never
be anywhere speed-critical, and pack them all together? Putting them all
together, ideally starting or ending on a page boundary, would (hopefully)
mean that they wouldn't even need to be swapped in unless an error
occurred.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9577#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list