[pypy-commit] extradoc extradoc: some more fixes from rhyolite
fijal
noreply at buildbot.pypy.org
Thu Oct 27 17:47:28 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: extradoc
Changeset: r3950:f55956fe1956
Date: 2011-10-27 17:47 +0200
http://bitbucket.org/pypy/extradoc/changeset/f55956fe1956/
Log: some more fixes from rhyolite
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,12 +89,13 @@
methods for common infrastructure or loading globals (instead of rebinding as
locals) is fast enough and improves code readability.
-Copying is expensive
---------------------
+String copying is expensive
+---------------------------
-If you use regular expressions replace, this would always copy a string as of
-now. If you know your regexp is simple, first try to match it if there is
-anything to replace in the first place. This is a pretty hard optimization to
+If you use ``re.sub``, the current implementation will always create a copy
+of the string even if there was no match to replace.
+If you know your regexp is simple, first try to check if there is
+anything to replace. This is a pretty hard optimization to
do automatically -- simply matching the regular expression can be too costly
for it to make sense. In our particular example however, the regexp is really
simple, checking ranges of characters. It also seems that this is by far the
More information about the pypy-commit
mailing list