summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-08-18 19:57:25 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-08-24 06:54:17 -0400
commitb282c54ebaaae13aa8b81f2380cdc20acaa9fc69 (patch)
tree887fbb3e7fc048f834c4e14e611dc79850b3d527
parentfd3dd69cc10026cf6d69925267134c11b281a803 (diff)
downloadpython-coveragepy-git-b282c54ebaaae13aa8b81f2380cdc20acaa9fc69.tar.gz
Make it run on PyPy for time tests there
-rw-r--r--lab/gendata.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/lab/gendata.py b/lab/gendata.py
index 0e9c6b6f..27ad4fda 100644
--- a/lab/gendata.py
+++ b/lab/gendata.py
@@ -1,3 +1,5 @@
+# Run some timing tests of JsonData vs SqliteData.
+
import random
import time
@@ -16,7 +18,7 @@ def gen_data(cdata):
start = time.time()
for i in range(NUM_FILES):
- filename = f"/src/foo/project/file{i}.py"
+ filename = "/src/foo/project/file{i}.py".format(i=i)
line_data = { filename: dict.fromkeys(linenos(NUM_LINES, .6)) }
cdata.add_lines(line_data)
@@ -34,7 +36,7 @@ class DummyData:
overhead = gen_data(DummyData())
jtime = gen_data(CoverageJsonData("gendata.json")) - overhead
stime = gen_data(CoverageSqliteData("gendata.db")) - overhead
-print(f"Overhead: {overhead:.3f}s")
-print(f"JSON: {jtime:.3f}s")
-print(f"SQLite: {stime:.3f}s")
-print(f"{stime / jtime:.3f}x slower")
+print("Overhead: {overhead:.3f}s".format(overhead=overhead))
+print("JSON: {jtime:.3f}s".format(jtime=jtime))
+print("SQLite: {stime:.3f}s".format(stime=stime))
+print("{slower:.3f}x slower".format(slower=stime/jtime))