[GHC] #15519: Minor code refactoring leads to drastic performance degradation