
#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 xnyhps): Yeah, I have Windows and Linux available to test on. Other architectures (PPC/ARM/...) not as easily, so I'll keep the generated code for those unchanged. Gathering up some discussion from GCC about alignment of string literals: * https://gcc.gnu.org/ml/gcc/2002-01/msg01068.html * https://gcc.gnu.org/ml/gcc-patches/2004-01/msg02835.html: {{{ * config/i386/i386.c (ix86_constant_alignment): Decrease alignment of long string literals from 32 bytes to sizeof (void *) when !-Os and to 1 with -Os. }}} * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22158 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9577#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler