diff options
author | Yurii Karabas <1998uriyyo@gmail.com> | 2020-11-25 10:43:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 10:43:18 (GMT) |
commit | 7301979b23406220510dd2c7934a21b41b647119 (patch) | |
tree | 296b337317ac71d34001c17f4b4b7bea918cbf6f /Misc/NEWS.d | |
parent | 85c84920f511d0d73a133336daeaf715a022cd64 (diff) | |
download | cpython-7301979b23406220510dd2c7934a21b41b647119.zip cpython-7301979b23406220510dd2c7934a21b41b647119.tar.gz cpython-7301979b23406220510dd2c7934a21b41b647119.tar.bz2 |
bpo-42202: Store func annotations as a tuple (GH-23316)
Reduce memory footprint and improve performance of loading modules having many func annotations.
>>> sys.getsizeof({"a":"int","b":"int","return":"int"})
232
>>> sys.getsizeof(("a","int","b","int","return","int"))
88
The tuple is converted into dict on the fly when `func.__annotations__` is accessed first.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2020-11-16-18-13-07.bpo-42202.ZxenYD.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-11-16-18-13-07.bpo-42202.ZxenYD.rst b/Misc/NEWS.d/next/Core and Builtins/2020-11-16-18-13-07.bpo-42202.ZxenYD.rst new file mode 100644 index 0000000..aba8ce6 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-11-16-18-13-07.bpo-42202.ZxenYD.rst @@ -0,0 +1,2 @@ +Change function parameters annotations internal representation to tuple +of strings. Patch provided by Yurii Karabas. |