Skip to content
  • Michal Terepeta's avatar
    Generate straightline code for inline array allocation · 63b7d5fb
    Michal Terepeta authored and Marge Bot's avatar Marge Bot committed
    
    
    GHC has an optimization for allocating arrays when the size is
    statically known -- it'll generate the code allocating and initializing
    the array inline (instead of a call to a procedure from
    `rts/PrimOps.cmm`).
    
    However, the generated code uses a loop to do the initialization. Since
    we already check that the requested size is small (we check against
    `maxInlineAllocSize`), we can generate faster straightline code instead.
    This brings about 15% improvement for `newSmallArray#` in my testing and
    slightly simplifies the code in GHC.
    
    Signed-off-by: default avatarMichal Terepeta <michal.terepeta@gmail.com>
    63b7d5fb