Skip to content

Change in specialisation(?) behaviour since 8.0.2 causes 6x slowdown

I was investigating some benchmarks and I noticed some odd results if I duplicated one of my tests.

Reproduction: https://github.com/mpickering/probable-eureka

Looking at the core, it seems that repeating the definition means that one of the key functions doesn't get specialised as expected which leads to a much slower program.

Observe that in the first two benchmarks there is a worker function go :: Int# -> Int -> ReaderT Int (StateT Int Identity Int but in the third benchmark this is specialised to $sgo :: Int# -> Int -> Int -> Int# -> Int# -> Identity (Int, Int). Removing the duplicate benchmark means that specialisation happens properly in the first case as well.

The proper specialisation also happens in 8.0.2.

This causes the first two cases to be 6x slower than the last case.

Trac metadata
Trac field Value
Version 8.2.1-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information