[pypy-commit] pypy jit-counter: Adjust "decay" for measured usage (translate.py --annotate): massively

arigo noreply at buildbot.pypy.org
Thu Oct 31 21:49:09 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: jit-counter
Changeset: r67788:fd0ea52daeaf
Date: 2013-10-31 21:48 +0100
http://bitbucket.org/pypy/pypy/changeset/fd0ea52daeaf/

Log:	Adjust "decay" for measured usage (translate.py --annotate):
	massively reduce the per-minor-collection count, but not the per-
	new-loop count. Done by only calling decay_all_counters() every 64
	minor collections rather than every time.

diff --git a/rpython/jit/metainterp/counter.py b/rpython/jit/metainterp/counter.py
--- a/rpython/jit/metainterp/counter.py
+++ b/rpython/jit/metainterp/counter.py
@@ -25,8 +25,15 @@
         self._nextindex = r_uint(0)
         #
         if translator is not None:
+            self._decay_phase = 0
             def invoke_after_minor_collection():
-                self.decay_all_counters()
+                # After 64 minor collections, we call decay_all_counters().
+                # The "--jit decay=N" option measures the amount the
+                # counters are then reduced by.
+                self._decay_phase += 1
+                if self._decay_phase == 64:
+                    self._decay_phase = 0
+                    self.decay_all_counters()
             if not hasattr(translator, '_jit2gc'):
                 translator._jit2gc = {}
             translator._jit2gc['invoke_after_minor_collection'] = (
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -442,7 +442,7 @@
     'threshold': 'number of times a loop has to run for it to become hot',
     'function_threshold': 'number of times a function must run for it to become traced from start',
     'trace_eagerness': 'number of times a guard has to fail before we start compiling a bridge',
-    'decay': 'decay counters at each minor collection (0=none, 1000=max)',
+    'decay': 'amount to regularly decay counters by (0=none, 1000=max)',
     'trace_limit': 'number of recorded operations before we abort tracing with ABORT_TOO_LONG',
     'inlining': 'inline python functions or not (1/0)',
     'loop_longevity': 'a parameter controlling how long loops will be kept before being freed, an estimate',
@@ -456,7 +456,7 @@
 PARAMETERS = {'threshold': 1039, # just above 1024, prime
               'function_threshold': 1619, # slightly more than one above, also prime
               'trace_eagerness': 200,
-              'decay': 25,
+              'decay': 40,
               'trace_limit': 6000,
               'inlining': 1,
               'loop_longevity': 1000,


More information about the pypy-commit mailing list