Repository navigation
Commit aa0e410
authored
AST nodes had an explicit `__dict__` slot, so every node built by
`ast.parse` allocated its own dict. With `Py_TPFLAGS_MANAGED_DICT`,
node attributes are stored as inline values with shared keys instead.
`ast.parse` is ~15.8% faster, walking trees is ~15.9% faster, and
the memory used by the AST trees is reduced by ~51.6%.
1 parent 2468c35 commit aa0e410
6 files changed
Lines changed: 23 additions & 27 deletions
File tree
- Lib/test
- test_ast
- Misc/NEWS.d/next/Core_and_Builtins
- Parser
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2042 | 2042 | | |
2043 | 2043 | | |
2044 | 2044 | | |
2045 | | - | |
| 2045 | + | |
2046 | 2046 | | |
2047 | 2047 | | |
2048 | 2048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
913 | 913 | | |
914 | 914 | | |
915 | 915 | | |
916 | | - | |
917 | 916 | | |
918 | 917 | | |
919 | 918 | | |
| |||
923 | 922 | | |
924 | 923 | | |
925 | 924 | | |
926 | | - | |
| 925 | + | |
927 | 926 | | |
928 | 927 | | |
929 | 928 | | |
| |||
935 | 934 | | |
936 | 935 | | |
937 | 936 | | |
938 | | - | |
939 | | - | |
| 937 | + | |
940 | 938 | | |
941 | 939 | | |
942 | 940 | | |
943 | 941 | | |
944 | 942 | | |
945 | | - | |
946 | | - | |
| 943 | + | |
947 | 944 | | |
948 | 945 | | |
949 | 946 | | |
| |||
1419 | 1416 | | |
1420 | 1417 | | |
1421 | 1418 | | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | | - | |
1426 | | - | |
1427 | 1419 | | |
1428 | 1420 | | |
1429 | 1421 | | |
| |||
1668 | 1660 | | |
1669 | 1661 | | |
1670 | 1662 | | |
1671 | | - | |
1672 | 1663 | | |
1673 | 1664 | | |
1674 | 1665 | | |
| |||
1682 | 1673 | | |
1683 | 1674 | | |
1684 | 1675 | | |
1685 | | - | |
| 1676 | + | |
| 1677 | + | |
1686 | 1678 | | |
1687 | 1679 | | |
1688 | 1680 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments