[pypy-commit] extradoc extradoc: mention generators

fijal noreply at buildbot.pypy.org
Thu Oct 27 17:27:26 CEST 2011

Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: extradoc
Changeset: r3947:f79ab024b2c1
Date: 2011-10-27 17:25 +0200

Log:	mention generators

diff --git a/blog/draft/faster-json.rst b/blog/draft/faster-json.rst
--- a/blog/draft/faster-json.rst
+++ b/blog/draft/faster-json.rst
@@ -89,6 +89,17 @@
 methods for common infrastructure or loading globals (instead of rebinding as
 locals) is fast enough and improves code readability.
+Generators are slower than they should be
+I changed the entire thing to simply call ``builder.append`` instead of
+yielding to the main loop where it would be gathered. This is kind of a PyPy
+bug that using generators extensively is slower, but a bit hard to fix.
+Especially in cases where there is relatively little data being passed around
+(few bytes), it makes sense to gather it first. If I were to implement an
+efficient version of ``iterencode``, I would probably handle chunks of
+predetermined size, about 1000 bytes instead of yielding data every few bytes.
 I must admit I worked around PyPy's performance bug

More information about the pypy-commit mailing list