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

Improve generated code for derived instances #3189

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Nov 22, 2024

  • Closes Improve the inlining optimization to handle derived instances well #3186
  • Changes the generated code for derived Eq instances to define a local recursive function with a let instead of a lambda. This is necessary, because otherwise an indirection is generated on each recursive call -- instance resolution inserts the instance identifier, which then is matched on and the function for the recursive call extracted instead of being called directly. This cannot be (easily) optimized in Core because, to avoid looping in the compiler, in general one cannot do inlining of recursive functions.
  • Minor improvements to the inlining optimization and the main optimization phase: do inlining before specialization and more liberal rules for heuristic case value inlining.

@lukaszcz lukaszcz added this to the 0.6.9 milestone Nov 22, 2024
@lukaszcz lukaszcz self-assigned this Nov 22, 2024
@lukaszcz lukaszcz force-pushed the better-inline-case branch 3 times, most recently from 4992e43 to d4305a7 Compare November 25, 2024 13:38
@lukaszcz lukaszcz marked this pull request as ready for review November 25, 2024 13:38
@lukaszcz lukaszcz mentioned this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the inlining optimization to handle derived instances well
1 participant