Feature or enhancement
Proposal:
There's new PyBytesWriter() API:
There's an ongoing effort of introducing it in various places:
action_helpers.c's _build_concatenated_bytes, which is a part of the PEG parser, is a great candidate for using PyBytesWriter API with its PyBytes_Concat:
|
PyBytes_Concat(&res, elem->v.Constant.value); |
This seems to be quadratic time complexity, while using a modern API and just a single copy is possible!
Inspired by gh-140139, I found this while grepping for PyBytes_Concat and PyUnicodeWriter. My hypothesis is that for many there's a missing PyBytesWriter yang.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
There's new
PyBytesWriter()API:There's an ongoing effort of introducing it in various places:
action_helpers.c's_build_concatenated_bytes, which is a part of the PEG parser, is a great candidate for usingPyBytesWriterAPI with itsPyBytes_Concat:cpython/Parser/action_helpers.c
Line 1624 in 6416e6e
This seems to be quadratic time complexity, while using a modern API and just a single copy is possible!
Inspired by gh-140139, I found this while grepping for
PyBytes_ConcatandPyUnicodeWriter. My hypothesis is that for many there's a missingPyBytesWriteryang.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
PyBytesWriterinaction_helpers.c's_build_concatenated_bytes; 3x fasterbytesconcat in the parser #140150