summaryrefslogtreecommitdiff
path: root/lab
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-07-09 16:22:51 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-07-10 06:57:24 -0400
commit6b226d85f5191cd27b20ad27caded8b407772a02 (patch)
treea7d2e58246fb5ef9b8128ff342e97968c4ace853 /lab
parent9bc6b93805a5f20a87211a315d00503eddab66dc (diff)
downloadpython-coveragepy-git-6b226d85f5191cd27b20ad27caded8b407772a02.tar.gz
Remove the JSON data code
Diffstat (limited to 'lab')
-rw-r--r--lab/gendata.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/lab/gendata.py b/lab/gendata.py
deleted file mode 100644
index 27ad4fda..00000000
--- a/lab/gendata.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# Run some timing tests of JsonData vs SqliteData.
-
-import random
-import time
-
-from coverage.data import CoverageJsonData
-from coverage.sqldata import CoverageSqliteData
-
-NUM_FILES = 1000
-NUM_LINES = 1000
-
-def gen_data(cdata):
- rnd = random.Random()
- rnd.seed(17)
-
- def linenos(num_lines, prob):
- return (n for n in range(num_lines) if random.random() < prob)
-
- start = time.time()
- for i in range(NUM_FILES):
- filename = "/src/foo/project/file{i}.py".format(i=i)
- line_data = { filename: dict.fromkeys(linenos(NUM_LINES, .6)) }
- cdata.add_lines(line_data)
-
- cdata.write()
- end = time.time()
- delta = end - start
- return delta
-
-class DummyData:
- def add_lines(self, line_data):
- return
- def write(self):
- return
-
-overhead = gen_data(DummyData())
-jtime = gen_data(CoverageJsonData("gendata.json")) - overhead
-stime = gen_data(CoverageSqliteData("gendata.db")) - overhead
-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))