Commits

Armin Rigo committed fd0ea52

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.

Comments (0)

Files changed (2)

rpython/jit/metainterp/counter.py

         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'] = (
     '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',
 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,