Author: Alex Gaynor <[email protected]>
Branch:
Changeset: r51414:33bd443587ba
Date: 2012-01-17 12:51 -0600
http://bitbucket.org/pypy/pypy/changeset/33bd443587ba/
Log: split _codecs.lookup_codec into parts with and without a loop, so
the JIT can inline most of lookup_codec, eventually it might even
make sense to make this codec_search_cache thing be a purefunction,
but I'm not sure what it's sematnics are ATM
diff --git a/pypy/module/_codecs/interp_codecs.py
b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -108,6 +108,10 @@
w_result = state.codec_search_cache.get(normalized_encoding, None)
if w_result is not None:
return w_result
+ return _lookup_codec_loop(space, encoding, normalized_encoding)
+
+def _lookup_codec_loop(space, encoding, normalized_encoding):
+ state = space.fromcache(CodecState)
if state.codec_need_encodings:
w_import = space.getattr(space.builtin, space.wrap("__import__"))
# registers new codecs
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit