]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-43950: optimize column table assembling with pre-sizing object (GH-26997)
authorBatuhan Taskaya <batuhan@python.org>
Fri, 2 Jul 2021 19:03:58 +0000 (22:03 +0300)
committerGitHub <noreply@github.com>
Fri, 2 Jul 2021 19:03:58 +0000 (12:03 -0700)
commitec8759b060eff83ff466f42c5a96d83a685016ce
tree546e1151c7f5f295bb885ea7ca690effb264cea3
parent2560c612c89ea2534b90a266aabf76dc74d93a12
bpo-43950: optimize column table assembling with pre-sizing object (GH-26997)

The new resizing system works like this;
```
$ cat t.py
a + a + a + b + c + a + a + a + b + c + a + a + a + b + c + a + a + a + b + c
[repeated 99 more times]
$ ./python t.py
RESIZE: prev len = 32, new len = 66
FINAL SIZE: 56
-----------------------------------------------------
RESIZE: prev len = 32, new len = 66
RESIZE: prev len = 66, new len = 134
RESIZE: prev len = 134, new len = 270
RESIZE: prev len = 270, new len = 542
RESIZE: prev len = 542, new len = 1086
RESIZE: prev len = 1086, new len = 2174
RESIZE: prev len = 2174, new len = 4350
RESIZE: prev len = 4350, new len = 8702
FINAL SIZE: 8004
```

So now we do considerably lower number of `_PyBytes_Resize` calls.

Automerge-Triggered-By: GH:isidentical
Python/compile.c