-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Performance regression 0.770 -> 0.780 due to zip() stub #9016
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
Comments
On my macOS:
0.770
Not that severe, but definitely some performance regression. |
Interesting that the number of modules checked goes up by one. Running with |
Yeah sure, one module up and one error up. https://www.diffchecker.com/Fs4iNvez
☝️ This is the new module. |
I was also able to reproduce the issue on macOS (timings are similar to what @TH3CHARLie reported). I will investigate this. |
I've narrowed it down to python/typeshed#3830. This has the side effect of causing the type checking of this statement to take several seconds (found in widths = tuple(
zip(
('line', 'col', 'error_type', 'linter_name', 'code'),
map(
max,
zip(*[
(
len(str(error['line'] + 1)),
len(str(error['start'] + 1)),
len(error['error_type']),
len(error['linter']),
len(str(error['code'])),
)
for error in flatten(errors_by_file.values())
])
)
)
) # type: Tuple[Tuple[str, int], ...] There may other things going on as well, but this looks like the biggest issue. The above statement triggers exponential slowdown in mypy, and the typeshed change made things worse. A simple workaround would be to split the statement into multiple ones, each with only a single I'll see if there is some simple optimization we can use to speed up cases like this. Related (but not identical) issues have been reported before. |
Removing or rewriting the statement brings the execution time down to 2,5-2,8 secs. Esp. it is enough to take the inner starzip Unfortunately mypy now doesn't like the
I now have to have an ignore comment here. This code checks fine in 0.770. (Hm, looks like mypy doesn't understand |
@kaste After removing the statement performance is similar on 0.780 for me on macOS. Is 0.780 consistently slower on Windows? What if you use |
Well, yeah, completely removing the statement performs the same on both mypy versions. But the rewritten version I just posted, I cannot just remove the statement obviously, shows a performance regression from ~1,9s -> 2,5-2,8s. If I use |
Thanks for clarification. It seems that the performance regression is specific to |
Note typeshed reverted the relevant changes to zip in python/typeshed#4254 |
This can be closed after a typeshed sync. |
Typeshed has been synced, so this should be back to how it worked in 0.770. @kaste Can you verify that the performance regression has been fixed on GitHub master? |
With current master exec time is ~3.9-4.0 while on 0.770 I have ~3.7s. Checking the whole project takes 9,9-10 on master, and ~9,6-7 with 0.770. Clearly no excess here but a degradation. |
After upgrading to 0.780 I found a severe performance regression. Luckily, on open software so I can reproduce it as follows. This is on Windows. The program is at https://github.com/SublimeLinter/SublimeLinter
So I cloned into
D:\SublimeLinter\
, of importance is that you lintpanel_view.py
using the absolute path. (Note that other top level files here are as fast as before.)On mypy 0.770, this ends with
On mypy 0.780:
The text was updated successfully, but these errors were encountered: