Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unzip Map and IntMap more efficiently #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

treeowl
Copy link

@treeowl treeowl commented Aug 22, 2021

The previous Map (same for IntMap throughout) instance
would first map eagerly over tha Map, producing an entire
Map full of thunks to apply the unzipWith function. Then
it would build two more entire Maps full of thunks to select
components of each pair. Depending on inlining and such, the
resulting maps may or may not have contained selector thunks;
if not, they could leak memory. Fix that.

NOTE: This PR is an alternative to #163. This one preserves
the precise laziness properties of the previous implementation.

The previous `Map` (same for `IntMap` throughout) instance
would first map eagerly over tha `Map`, producing an entire
`Map` full of thunks to apply the `unzipWith` function. Then
it would build two more entire `Map`s full of thunks to select
components of each pair. Depending on inlining and such, the
resulting maps may or may not have contained selector thunks;
if not, they could leak memory. Fix that.

NOTE: This PR is an alternative to haskellari#163. This one preserves
the precise laziness properties of the previous implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant