Skip to content

Pattern synonym performance

I introduce a pattern synonym in GHC

tweag/ghc@d9833b38

This causes five performance tests to fail https://gitlab.haskell.org/tweag/ghc/-/pipelines/38665.

T12227(normal) ghc/alloc   462602822.0   468124632.0  +1.2% BAD
 T3064(normal) ghc/alloc   191629750.0   195597680.0  +2.1% BAD
 T5030(normal) ghc/alloc   366141150.0   373936984.0  +2.1% BAD
T9872b(normal) ghc/alloc  2308378242.0  2336048448.0  +1.2% BAD
T9872d(normal) ghc/alloc   559641592.0   578809016.0  +3.4% BAD

I'm surprised that a relatively simple refactoring has this impact. Is there a bug? Could other pattern synonyms in GHC be causing a slowdown?

I cannot use the INLINE pragma on the pattern synonym yet, because it's available only from 9.2.

Original ticket: #18750.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information