这是indexloc提供的服务,不要输入任何密码
Skip to content

avoid calling normalize-type outside of shallow tr #1296

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

Merged
merged 1 commit into from
Dec 13, 2022
Merged

Conversation

bennn
Copy link
Contributor

@bennn bennn commented Dec 12, 2022

Fix the slowdown reported in #1293

Saves about 600 seconds on my machine on this command:

rm compiled */compiled
time raco make -j 8 cmdline.rkt
  • Before = 861s
  • After = 250s

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resyntax analyzed 1 file in this pull request and found no issues.

@bennn bennn merged commit d455a50 into racket:master Dec 13, 2022
@bennn
Copy link
Contributor Author

bennn commented Dec 13, 2022

This fixes the regression, but there are two reasons we might want a different change:

  1. Shallow still calls normalize-type. If soft-contract got ported to Shallow TR, it would be slow to typecheck.
  2. Now that Deep and Optional don't call normalize type, Shallow might have a higher runtime cost for interacting with them. Take Optional for example. If Optional sends a function f to Shallow, then Shallow has to check that f is a function and maybe has to check the shape of results (f x). It depends on whether f is marked as trusted. Removing the normalize-type might remove the mark in some common cases.

Ideally we should either remove normalize-type in all cases (because it doesn't save enough runtime checks to justify the compile-time costs) or use it carefully but consistently across Shallow, Deep, and Optional.

@samth
Copy link
Member

samth commented Dec 13, 2022

I think the real question is why is normalize-type so slow. Contract generation involves multiple passes over types, so adding this one shouldn't have been an enormous slowdown.

@mfelleisen
Copy link

I brought this up with Ben before: Asumu spent a lot of time wresting with types because they become very large. Sharing as much as possible solved his problem. Is something similar going on here?

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.

4 participants