[pypy-commit] pypy json-decoder-maps: explain MIN_SIZE_FOR_STRING_CACHE

cfbolz pypy.commits at gmail.com
Thu Sep 19 14:08:50 EDT 2019


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: json-decoder-maps
Changeset: r97544:434116a59d15
Date: 2019-09-19 19:54 +0200
http://bitbucket.org/pypy/pypy/changeset/434116a59d15/

Log:	explain MIN_SIZE_FOR_STRING_CACHE

diff --git a/pypy/module/_pypyjson/interp_decoder.py b/pypy/module/_pypyjson/interp_decoder.py
--- a/pypy/module/_pypyjson/interp_decoder.py
+++ b/pypy/module/_pypyjson/interp_decoder.py
@@ -59,7 +59,10 @@
 
     DEFAULT_SIZE_SCRATCH = 20
 
-    # <antocuni> put a comment explaining what it does and why this is a reasonable number
+    # string caching is only used if the total size of the message is larger
+    # than a megabyte. Below that, there can't be that many repeated big
+    # strings anyway (some experiments showed this to be a reasonable cutoff
+    # size)
     MIN_SIZE_FOR_STRING_CACHE = 1024 * 1024
 
     # evaluate the string cache for 200 strings, before looking at the hit rate


More information about the pypy-commit mailing list