Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r91907:75b45f45de1b
Date: 2017-07-16 16:22 +0200
http://bitbucket.org/pypy/pypy/changeset/75b45f45de1b/

Log:    Improve performance of bytearray.extend(<bytes>)

diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -748,8 +748,11 @@
     if space.isinstance_w(w_source, space.w_unicode):
         raise oefmt(space.w_TypeError,
                     "cannot convert a (unicode) str object to bytes")
+    return _from_byte_sequence(space, w_source)
 
-    # sequence of bytes
+
+def _from_byte_sequence(space, w_source):
+    # Split off in a separate function for the JIT's benefit
     w_result = space.appexec([w_source], """(seq):
         result = bytearray()
         for i in seq:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to