Skip to content

Optimize inferred partial constraint fn#3218

Merged
natefaubion merged 5 commits intopurescript:masterfrom
matthewleon:optimize-corefn-partial-unused
Dec 12, 2018
Merged

Optimize inferred partial constraint fn#3218
natefaubion merged 5 commits intopurescript:masterfrom
matthewleon:optimize-corefn-partial-unused

Conversation

@matthewleon
Copy link
Copy Markdown
Contributor

fixes #3157

supersedes #3195

Adds a CoreFn optimization pass.

@matthewleon
Copy link
Copy Markdown
Contributor Author

This is ready for review.

@matthewleon
Copy link
Copy Markdown
Contributor Author

Some thoughts here: The ad-hoc nature of this optimization isn't especially pleasing. On the other hand, I do believe that it's fixing a bug: Without this, code that really seems like it should get TCOd, doesn't, leading to potential run-time explosions.

If people can think of a smarter way to deal with this, I'm really open to it.

@gabejohnson
Copy link
Copy Markdown

Since I presume more optimizations will be added in the future (see #3244), some of which may be more expensive to perform, it might be a good idea to put these behind a flag.

@garyb
Copy link
Copy Markdown
Member

garyb commented Apr 24, 2018

@matthewleon would you mind perhaps opening a PR that adds the corefn pass but that doesn't do anything? I have some concerns about the way this optimization is applied at the moment (in that it could be too wide reaching, given it's not actually Partial-specific) and would like to spend some time experimenting with that. But also #3244 is based on this (in that it uses a corefn pass), and I think that one is good to go in.

@matthewleon
Copy link
Copy Markdown
Contributor Author

matthewleon commented Apr 24, 2018 via email

matthewleon added a commit to matthewleon/purescript that referenced this pull request Apr 25, 2018
it does nothing for the moment

created in response to purescript#3218 (comment)
@matthewleon
Copy link
Copy Markdown
Contributor Author

I'll rebase this after merge of #3319 so that it becomes a PR for just the inferred partial constraint optimization.

matthewleon added a commit to matthewleon/purescript that referenced this pull request Apr 25, 2018
it does nothing for the moment

created in response to purescript#3218 (comment)
@natefaubion
Copy link
Copy Markdown
Contributor

@matthewleon Are you interested in picking this back up?

@matthewleon
Copy link
Copy Markdown
Contributor Author

Are you interested in picking this back up?

Yes. Will do it on Wednesday.

@matthewleon matthewleon force-pushed the optimize-corefn-partial-unused branch 2 times, most recently from 8e44cca to a0ffb7a Compare October 25, 2018 02:29
@matthewleon matthewleon force-pushed the optimize-corefn-partial-unused branch from a0ffb7a to db255c2 Compare October 25, 2018 02:33
@matthewleon
Copy link
Copy Markdown
Contributor Author

@natefaubion rebased and fixed the conflict. Please feel free to correct the composition order I chose for the optimizations if there is a problem there.

@natefaubion natefaubion merged commit a12b0e6 into purescript:master Dec 12, 2018
@natefaubion
Copy link
Copy Markdown
Contributor

Thanks!

@garyb garyb mentioned this pull request Jan 12, 2019
3 tasks
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.

Partial functions can foil TCO

4 participants