forked from python/mypy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mypyc] Remove unused labels and gotos (python#15244)
This PR removes labels which are never jumped to, as well as removing gotos that jump directly to the next label (and removes the now redundant label). I had a small issue with the `GetAttr` op code as it would insert C code after the end of the branch which could not be detected at the IR level, as seen in mypyc/mypyc#600 (comment) . Here are some basic stats on the file sizes before and after this PR: Building with `MYPY_OPT_LEVEL=0`, `MYPY_DEBUG_LEVEL=1`: | Branch | `.so` size | `.c` size | `.c` lines | |----------|-----------------|-----------------|-----------------| | `master` | 43.9 MB | 79.7 MB | 2290675 | | This PR | 43.6 MB (-0.6%) | 78.6 MB (-1.4%) | 2179967 (-4.8%) | Building with `MYPY_OPT_LEVEL=3`, `MYPY_DEBUG_LEVEL=0`: | Branch | `.so` size | `.c` size | `.c` lines | |----------|------------|-----------|------------| | `master` | 26.5 MB | 79.7 MB | 2291316 | | This PR | 26.5 MB | 78.7 MB | 2179701 | (I don't know why the number of lines changes between optimization levels. It's only a couple hundred lines, perhaps Mypyc is emitting different code depending on optimization level?) Unoptimized builds seem to benefit the most, while optimized builds look pretty much the same. I didn't check to see if they are *exactly* the same binary, but they are probably close if not the same. The biggest win is the drop in the number of lines C code being generated. Closes mypyc/mypyc#600
- Loading branch information
Showing
4 changed files
with
35 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters