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

Add mypy_types benchmark #102

Closed
wants to merge 13 commits into from

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented May 26, 2021

Fixes #35. Ported from Pyston.

@Fidget-Spinner
Copy link
Member Author

Huh, I forgot that mypy doesn't support pypy due to dependence on CPython AST. I wonder if there's a way to skip installation of mypy and this specific benchmark just for pypy?

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

Can you try not not add the benchmark to DEFAULT_GROUP if you are running PyPy?

@Fidget-Spinner
Copy link
Member Author

Yay the tests are finally passing! This should ready for review now. Please take a look when you have the time Victor.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

LGTM. @ericsnowcurrently take note!

@Fidget-Spinner
Copy link
Member Author

Recently I remembered mypy uses mypyc for speedups. I'm inclined to pass --no-binary to pip so that the benchmark runs more python code (and less C extension code). WDYT?

Though I'm not sure how to pass in that argument just for mypy. Seems like pip-compile will add the argument to all other packages, which will affect django among others.

@gvanrossum
Copy link
Member

I just was reminded of this PR again. Do we still need to do this when we have Eric's more general #109?

Recently I remembered mypy uses mypyc for speedups. I'm inclined to pass --no-binary to pip so that the benchmark runs more python code (and less C extension code). WDYT?

Oh, definitely. Benchmarking mypy with mypyc's speedups says more about mypyc than about the Python interpreter used to run it.

Though I'm not sure how to pass in that argument just for mypy. Seems like pip-compile will add the argument to all other packages, which will affect django among others.

Maybe #109 will help there too? It has a separate toml file per benchmark. I believe Eric also has prepared mods for the Pyston benchmarks that makes them runnable with his new infrastructure; I think it would be a shame if the Pyston benchmarks were forked. We should probably talk to the Pyston team about this before proceeding (@kmod, @undingen).

@@ -24,6 +24,10 @@ markupsafe==1.1.1
# via mako
mpmath==1.2.1
# via sympy
mypy-extensions==0.4.3
# via mypy
mypy==0.812
Copy link
Member

@pablogsal pablogsal Oct 6, 2021

Choose a reason for hiding this comment

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

This is probably going to pick up the extension if the wheel is available and the pure python if not, which may give different numbers in different versions. Am I mistaken? Maybe I am missing something.

Edit: I saw this is being discussed already on the PR.

@Fidget-Spinner
Copy link
Member Author

Fidget-Spinner commented Oct 6, 2021

I just was reminded of this PR again. Do we still need to do this when we have Eric's more general #109?

Eric's solution is definitely technically superior (I'm a big fan of his work in that PR). This PR still serves a purpose in adding mypy to the default list of benchmarks in pyperformance. Which I'd assume shows up on speed.python.org (maybe?).

I'm not sure how speed.python.org's pyperformance is updated. If it's Pablo/Victor/Zach/Dong-hee manually updating the pyperformance in there, we can always add a curated list of additional benchmarks to run via Eric's work -- mypy being one of them. Then I can just close this PR.

@vstinner
Copy link
Member

vstinner commented Oct 6, 2021

This is probably going to pick up the extension if the wheel is available and the pure python if not, which may give different numbers in different versions. Am I mistaken? Maybe I am missing something.

If you really don't want to measure the C implementation of mypy, the benchmark should have an option to decide which implementations is taken. See for example pyperformance/benchmarks/bm_pickle.py which implements such option and raises an error if it gets the wrong implementation.

@kmod
Copy link
Contributor

kmod commented Oct 6, 2021

fwiw in Pyston we run the benchmark without mypyc, but get that not 100% by choice because only the prebuilt mypy wheels are built with mypyc and building a fresh wheel yourself (like we need to do) will not use it.

@ericsnowcurrently
Copy link
Member

FYI, I've merged my PR that allows running benchmarks that aren't part of pyperformance. I also have a PR up against the Pyston benchmarks repo to allow them to be run using pyperformance: pyston/python-macrobenchmarks#3.

@Fidget-Spinner
Copy link
Member Author

@ericsnowcurrently awesome! I'll close this PR then since Pyston has the same.

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.

Add a benchmark that heavily uses type annotations
6 participants