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

A very modest typeclass caching #3127

Merged
merged 3 commits into from
Dec 2, 2023
Merged

Conversation

mtzguido
Copy link
Member

@mtzguido mtzguido commented Dec 2, 2023

This PR makes the resolve_implicits loop remember the solutions of typeclass arguments and reuse when the type of the implicit and the environment exactly match. It's pretty conservative, but easy to argue for its soundness and simple to implement, without any type of global persistent state.

It doesn't do a big difference in most cases, though, in a snippet like:

  f (show x);
  g (show x)

we cannot reuse the solution since the environment in the second line is different, it is extended with an extra unit binding.

@mtzguido mtzguido enabled auto-merge December 2, 2023 03:56
@mtzguido mtzguido merged commit ba86bcb into FStarLang:master Dec 2, 2023
2 checks passed
@mtzguido mtzguido deleted the tc_local_caching branch December 2, 2023 04:07
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