Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r158:77aa6fd8e4ec
Date: 2012-01-17 18:08 +0200
http://bitbucket.org/pypy/benchmarks/changeset/77aa6fd8e4ec/
Log: merge
diff --git a/own/bm_gzip.py b/own/bm_gzip.py
new file mode 100644
--- /dev/null
+++ b/own/bm_gzip.py
@@ -0,0 +1,45 @@
+import os
+import time
+import shutil
+import tempfile
+import tarfile
+
+DJANGO_DIR = os.path.join(os.path.dirname(__file__), os.pardir,
+ 'unladen_swallow', 'lib', 'django')
+
+def _bootstrap():
+ fd, archive = tempfile.mkstemp()
+ os.close(fd)
+ with tarfile.open(archive, 'w:gz') as targz:
+ targz.add(DJANGO_DIR)
+ return archive
+
+def bench(archive):
+ dest = tempfile.mkdtemp()
+ try:
+ with tarfile.open(archive) as targz:
+ targz.extractall(dest)
+ finally:
+ shutil.rmtree(dest)
+
+def main(n):
+ archive = _bootstrap()
+ try:
+ times = []
+ for k in range(n):
+ t0 = time.time()
+ bench(archive)
+ times.append(time.time() - t0)
+ return times
+ finally:
+ os.remove(archive)
+
+if __name__ == '__main__':
+ import util, optparse
+ parser = optparse.OptionParser(
+ usage="%prog [options]",
+ description="Test the performance of the GZip decompression benchmark")
+ util.add_standard_options_to(parser)
+ options, args = parser.parse_args()
+
+ util.run_benchmark(options, options.num_runs, main)
diff --git a/runner.py b/runner.py
--- a/runner.py
+++ b/runner.py
@@ -80,7 +80,7 @@
default=','.join(BENCHMARK_SET),
help=("Comma-separated list of benchmarks to run"
" Valid benchmarks are: " +
- ", ".join(BENCHMARK_SET)))
+ ", ".join(sorted(BENCHMARK_SET))))
parser.add_option('-p', '--pypy-c', default=sys.executable,
help='pypy-c or other modified python to run against')
parser.add_option('-r', '--revision', default=0, action="store",
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit