Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r73186:e435043d0dbe
Date: 2014-08-29 11:23 -0700
http://bitbucket.org/pypy/pypy/changeset/e435043d0dbe/
Log: Presize the StringBuilder to the length of the input string, which
is the minimum length for the output
diff --git a/pypy/module/_pypyjson/interp_encoder.py
b/pypy/module/_pypyjson/interp_encoder.py
--- a/pypy/module/_pypyjson/interp_encoder.py
+++ b/pypy/module/_pypyjson/interp_encoder.py
@@ -29,7 +29,7 @@
w_string = space.call_method(w_string, 'decode', space.wrap('utf-8'))
u = space.unicode_w(w_string)
- sb = StringBuilder()
+ sb = StringBuilder(len(u))
for c in u:
if c <= u'~':
if c == u'"' or c == u'\\':
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit