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

Perf regression caused by #5474 #5514

Closed
msullivan opened this issue Aug 20, 2018 · 0 comments
Closed

Perf regression caused by #5474 #5514

msullivan opened this issue Aug 20, 2018 · 0 comments
Assignees

Comments

@msullivan
Copy link
Collaborator

It looks likes #5474 caused a perf regression to the tune of 5% on a self check and in our internal repos.

@ilevkivskyi said he had an idea for fixing

@ilevkivskyi ilevkivskyi self-assigned this Aug 21, 2018
@ilevkivskyi ilevkivskyi mentioned this issue Aug 29, 2018
12 tasks
ilevkivskyi added a commit that referenced this issue Sep 12, 2018
Fixes #5514

The root cause is that #5474 added `type_parameter_checker` (a function) as one of the keys of subtype kinds. This function is a nested one, so in fact a _new_ function was created on every call to `is_subtype_ignoring_tvars()` causing many thousands parasitic keys created in subtype caches. In addition there are two smaller things listed below.

The performance win is around 5%
This PR:
* Moves the mentioned function to global scope, this causes only 6 subtype kinds present during self-check.
* Prevents similar regressions in future by switching only boolean flags as subtype kind keys.
* Removes two one liners that stay in a very hot code path (cache lookup is hit 140K times during self-check).
* Avoids creation of empty sets on cache look-up, create them only when writing to cache.
ilevkivskyi added a commit that referenced this issue Sep 12, 2018
Fixes #5514

The root cause is that #5474 added `type_parameter_checker` (a function) as one of the keys of subtype kinds. This function is a nested one, so in fact a _new_ function was created on every call to `is_subtype_ignoring_tvars()` causing many thousands parasitic keys created in subtype caches. In addition there are two smaller things listed below.

The performance win is around 5%
This PR:
* Moves the mentioned function to global scope, this causes only 6 subtype kinds present during self-check.
* Prevents similar regressions in future by switching only boolean flags as subtype kind keys.
* Removes two one liners that stay in a very hot code path (cache lookup is hit 140K times during self-check).
* Avoids creation of empty sets on cache look-up, create them only when writing to cache.
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

No branches or pull requests

2 participants