[Python-Dev] Re: _PyBytesWriter/_PyUnicodeWriter could be faster

2020-10-28 Thread Ma Lin
Thanks for your very informative reply. I replied you in issue41486. Maybe memory blocks will not bring performance improvement to _PyBytesWriter/_PyUnicodeWriter, which is a bit frustrating. > For a+b, Python first computes "a", then "b", and finally "a+b". I don't see > how your API could opt

[Python-Dev] _PyBytesWriter/_PyUnicodeWriter could be faster

2020-10-25 Thread Ma Lin
Some code needs to maintain an output buffer that has an unpredictable size. Such as bz2/lzma/zlib modules, _PyBytesWriter/_PyUnicodeWriter. In current code, when the output buffer grows, resizing will cause unnecessary memcpy(). issue41486 uses memory blocks to represent output buffer in bz2/l