Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
170 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f84137a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexbiehl would you mind taking a look at https://ghc.haskell.org/trac/ghc/ticket/7258#comment:87, and trying to figure out whether this commit here would do anything to address the issue there?
From what I understand about the issue, this here is very similar to what we were planning to try. The issue with
Read
instances for large record types boils down to thef10
example in the ticket:read
is implemented in terms ofReadP
, which introduces deeply nested CPS-style closures, and what happens then is that each time the next deeper level is entered, the parent closure is unpacked, and then the free variables are re-packed into the next closure. As GHC descends through the chain, the number of free variables to be copied grows linearly, so the overall performance is quadratic. Wholesale reusing the parent closure would, we hope, fix this, at the expense of making the final unpacking more expensive (though not quadratically so).Does that make sense? Am I understanding this commit correctly?
f84137a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.