Skip to content
Snippets Groups Projects
Commit 707a1242 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Drop now unused perfbench() and bench() functions.

parent baec9670
No related branches found
No related tags found
No related merge requests found
......@@ -96,12 +96,6 @@
return decorator
def bench(**kwargs):
def repo_setup(repo_name):
return hg.repository(ui.ui(), os.path.join(REPOS_DIR, repo_name))
return _bench_with_repo(repo_setup, **kwargs)
PERF_RE = re.compile(r'! wall (\d+.\d+) comb (\d+.\d+) user (\d+.\d+) sys (\d+.\d+) \(best of (\d+)\)')
......@@ -105,49 +99,6 @@
PERF_RE = re.compile(r'! wall (\d+.\d+) comb (\d+.\d+) user (\d+.\d+) sys (\d+.\d+) \(best of (\d+)\)')
def perfbench(**kwargs):
def repo_setup(repo_name):
def perf(command, *args):
venv = os.path.abspath(os.path.join(os.path.dirname(sys.executable), ".."))
if os.path.isdir(os.path.join(venv, "project")):
# Used with asv run (installed in virtualenv)
perfpath = os.path.join(venv, "project", "contrib", "perf.py")
hgpath = os.path.join(venv, "bin", "hg")
else:
# Used with asv dev (installed in ./mercurial)
perfpath = os.path.join(BASEDIR, "mercurial", "contrib", "perf.py")
hgpath = os.path.join(BASEDIR, "mercurial", "hg")
basecmd = [
hgpath, "--config", "extensions.perf=" + perfpath,
]
os.environ["HGRCPATH"] = ""
# test if the command exist in this perf.py version using 'hg help'
cmd = basecmd + [
"-R", os.path.join(REPOS_DIR, repo_name), command] + list(args)
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as exc:
if exc.returncode == 255:
# test if it return 255 because the command does not exist
# or if it's another issue
try:
output = subprocess.check_output(basecmd + ['help', command])
except subprocess.CalledProcessError as exc:
if exc.returncode == 255:
# command does not exist for this version of perf.py NaN
# result to n/a displayed in results which is a kind of
# "skipped" status
return float('nan')
raise
raise
match = PERF_RE.search(output)
if not match:
raise ValueError("Invalid output {0}".format(output))
return float(match.group(1))
return perf
return _bench_with_repo(repo_setup, **kwargs)
###
# Base classes for benchmarks
###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment