[PATCH 9 of 9 RFC] profiling: make statprof the default profiler (BC)

Gregory Szorc gregory.szorc at gmail.com
Tue Aug 16 01:25:16 EDT 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1471221528 25200
#      Sun Aug 14 17:38:48 2016 -0700
# Node ID d88d80210ff4351734d63b50e1af75f398af8963
# Parent  1975493743c5f68f28bf9dcf677df09d0265581a
profiling: make statprof the default profiler (BC)

The statprof sampling profiler runs with significantly less overhead.
Its data is therefore more useful. Furthermore, its default output
shows the hotpath by default, which I've found to be way more useful
than the default profiler's function time table.

diff --git a/mercurial/profiling.py b/mercurial/profiling.py
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -114,20 +114,20 @@ def statprofile(ui, fp):
 def profile(ui):
     """Start profiling.
 
     Profiling is active when the context manager is active. When the context
     manager exits, profiling results will be written to the configured output.
     """
     profiler = os.getenv('HGPROF')
     if profiler is None:
-        profiler = ui.config('profiling', 'type', default='ls')
+        profiler = ui.config('profiling', 'type', default='stat')
     if profiler not in ('ls', 'stat', 'flame'):
         ui.warn(_("unrecognized profiler '%s' - ignored\n") % profiler)
-        profiler = 'ls'
+        profiler = 'stat'
 
     output = ui.config('profiling', 'output')
 
     if output == 'blackbox':
         fp = util.stringio()
     elif output:
         path = ui.expandpath(output)
         fp = open(path, 'wb')


More information about the Mercurial-devel mailing list