[issue21377] PyBytes_Concat could try to concat in-place
Roundup Robot added the comment: New changeset 6234f4caba57 by Zachary Ware in branch 'default': Issue #21442: Fix MSVC compiler warning introduced by issue21377. http://hg.python.org/cpython/rev/6234f4caba57 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Antoine Pitrou added the comment: Thanks! The latest patch looks fine to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Roundup Robot added the comment: New changeset 4ed1b6c7e2f3 by Antoine Pitrou in branch 'default': Issue #21377: PyBytes_Concat() now tries to concatenate in-place when the first argument has a reference count of 1. http://hg.python.org/cpython/rev/4ed1b6c7e2f3 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Changes by Antoine Pitrou pit...@free.fr: -- resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Changes by Nikolaus Rath nikol...@rath.org: Added file: http://bugs.python.org/file35123/issue_21377_r4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Antoine Pitrou added the comment: Tentative patch attached. The test suite still passes, but I'm not sure if it actually exerts the new code path. A quick grep shows me that it should be exercised at least by Modules/_io/bufferedio.c. Otherwise, the way to test the C API is to add a function to Modules/_testcapi.c, and test that function from the relevant test file. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Antoine Pitrou added the comment: If I remember correctly, ceval.c has an optmisation for str += str even if the refcount is 2. Do we need to implement it or suggest to use bytearray or b''.join() instead? The latter, IMO. This issue is about the C API _PyBytes_Concat. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
STINNER Victor added the comment: If I remember correctly, ceval.c has an optmisation for str += str even if the refcount is 2. Do we need to implement it or suggest to use bytearray or b''.join() instead? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Changes by Nikolaus Rath nikol...@rath.org: Added file: http://bugs.python.org/file35100/issue_21377_r3.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
New submission from Antoine Pitrou: Currently, PyBytes_Concat always creates a new bytes object for the result. However, when Py_REFCNT(*pv) == 1, it could instead call _PyBytes_Resize() and then concat the second argument in place. (like e.g. _PyUnicode_Append does) -- components: Interpreter Core messages: 217406 nosy: haypo, nikratio, pitrou priority: normal severity: normal status: open title: PyBytes_Concat could try to concat in-place type: performance versions: Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Nikolaus Rath added the comment: Tentative patch attached. The test suite still passes, but I'm not sure if it actually exerts the new code path. Is there a standard way to test the C api? -- keywords: +patch Added file: http://bugs.python.org/file35084/issue_21377.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21377] PyBytes_Concat could try to concat in-place
Changes by Nikolaus Rath nikol...@rath.org: Added file: http://bugs.python.org/file35085/issue_21377_r2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21377 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com