File: bench.py

package info (click to toggle)
julia 1.5.3%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 91,132 kB
  • sloc: lisp: 278,486; ansic: 60,186; cpp: 29,801; sh: 2,403; makefile: 1,998; pascal: 1,313; objc: 647; javascript: 516; asm: 226; python: 161; xml: 34
file content (19 lines) | stat: -rw-r--r-- 545 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from functools import reduce
from textwrap import dedent as dd
from timeit import repeat


sources = ["canada", "citm_catalog", "citylots", "twitter"]

min_times = []
for source in sources:
    s = dd(f"""\
    with open("../data/{source}.json") as f:
        json.load(f)""")
    times = repeat(stmt=s, setup="import json", repeat=3, number=1)
    t = reduce(min, times)
    print(f"{source} {t:0.06f} seconds")
    min_times.append(t)

geo_mean = reduce(lambda a, b: a*b, min_times)**(1/len(min_times))
print(f"Total (G.M): {geo_mean:0.06f}")