Author: Armin Rigo <ar...@tunes.org>
Branch: bitstring
Changeset: r83959:e341fe8db539
Date: 2016-04-27 08:49 +0200
http://bitbucket.org/pypy/pypy/changeset/e341fe8db539/

Log:    Dump logs about the bitstring compression

diff --git a/rpython/jit/codewriter/effectinfo.py 
b/rpython/jit/codewriter/effectinfo.py
--- a/rpython/jit/codewriter/effectinfo.py
+++ b/rpython/jit/codewriter/effectinfo.py
@@ -445,6 +445,9 @@
     # across multiple Descrs if they always give the same answer (in
     # PyPy, it reduces the length of the bitstrings from 4000+ to
     # 373).
+    from rpython.jit.codewriter.policy import log
+
+    log("compute_bitstrings:")
     effectinfos = []
     descrs = {'fields': set(), 'arrays': set(), 'interiorfields': set()}
     for descr in all_descrs:
@@ -465,7 +468,11 @@
                     descrs[key].update(getattr(ei, '_write_descrs_' + key))
         else:
             descr.ei_index = sys.maxint
+    log("  %d effectinfos:" % (len(effectinfos),))
+    for key in sorted(descrs):
+        log("    %d descrs for %s" % (len(descrs[key]), key))
 
+    seen = set()
     for key in descrs:
         all_sets = []
         for descr in descrs[key]:
@@ -503,3 +510,11 @@
             bitstrw = bitstring.make_bitstring(bitstrw)
             setattr(ei, 'bitstring_readonly_descrs_' + key, bitstrr)
             setattr(ei, 'bitstring_write_descrs_' + key, bitstrw)
+            seen.add(bitstrr)
+            seen.add(bitstrw)
+
+    if seen:
+        mean_length = float(sum(len(x) for x in seen)) / len(seen)
+        max_length = max(len(x) for x in seen)
+        log("-> %d bitstrings, mean length %.1f, max length %d" % (
+            len(seen), mean_length, max_length))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to