diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/third_party/pyjson5/src/benchmarks | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/pyjson5/src/benchmarks')
3 files changed, 45 insertions, 25 deletions
diff --git a/chromium/third_party/pyjson5/src/benchmarks/chromium.linux.json b/chromium/third_party/pyjson5/src/benchmarks/chromium.linux.json index 3cb4bef44ae..3ee88cedc13 100644 --- a/chromium/third_party/pyjson5/src/benchmarks/chromium.linux.json +++ b/chromium/third_party/pyjson5/src/benchmarks/chromium.linux.json @@ -4133,15 +4133,15 @@ } }, { - "isolate_name": "devtools_lint_check", - "name": "devtools_lint_check", + "isolate_name": "devtools_closure_compile", + "name": "devtools_closure_compile", "swarming": { "can_use_on_swarming_builders": true } }, { - "isolate_name": "devtools_type_check", - "name": "devtools_type_check", + "isolate_name": "devtools_eslint", + "name": "devtools_eslint", "swarming": { "can_use_on_swarming_builders": true } diff --git a/chromium/third_party/pyjson5/src/benchmarks/mb_config.json b/chromium/third_party/pyjson5/src/benchmarks/mb_config.json index fc3a96a7e20..af93ef0f293 100644 --- a/chromium/third_party/pyjson5/src/benchmarks/mb_config.json +++ b/chromium/third_party/pyjson5/src/benchmarks/mb_config.json @@ -1966,7 +1966,7 @@ "gn_args": "internal_gles2_conform_tests=true" }, "java_coverage": { - "gn_args": "jacoco_coverage=true" + "gn_args": "emma_coverage=true emma_filter=\"org.chromium.*\"" }, "libfuzzer": { "gn_args": "use_libfuzzer=true" diff --git a/chromium/third_party/pyjson5/src/benchmarks/run.py b/chromium/third_party/pyjson5/src/benchmarks/run.py index 572755816c2..63eb2965dd1 100755 --- a/chromium/third_party/pyjson5/src/benchmarks/run.py +++ b/chromium/third_party/pyjson5/src/benchmarks/run.py @@ -22,11 +22,12 @@ import sys import time THIS_DIR = os.path.abspath(os.path.dirname(__file__)) -REPO_DIR = os.path.dirname(THIS_DIR) +REPO_DIR = os.path.dirname(THIS_DIR) if not REPO_DIR in sys.path: sys.path.insert(0, REPO_DIR) -import json5 +import json5 # pylint: disable=wrong-import-position + ALL_BENCHMARKS = ( 'ios-simulator.json', @@ -35,7 +36,9 @@ ALL_BENCHMARKS = ( 'chromium.perf.json', ) -DEFAULT_ITERATIONS = 1 + +DEFAULT_ITERATIONS = 3 + def main(): parser = argparse.ArgumentParser() @@ -54,18 +57,21 @@ def main(): # json.decoder.c_scanstring = py_scanstring - def py_maker(*_args, **_kwargs): - decoder = json.JSONDecoder() - decoder.scan_once = json.scanner.py_make_scanner(decoder) - decoder.parse_string = json.decoder.py_scanstring - json.decoder.scanstring = decoder.parse_string - return decoder + def py_maker(*args, **kwargs): + del args + del kwargs + decoder = json.JSONDecoder() + decoder.scan_once = json.scanner.py_make_scanner(decoder) + decoder.parse_string = json.decoder.py_scanstring + json.decoder.scanstring = decoder.parse_string + return decoder maker = py_maker if args.pure else json.JSONDecoder all_times = [] for i, c in enumerate(file_contents): - times = [] + json_time = 0.0 + json5_time = 0.0 for _ in range(args.num_iterations): start = time.time() json_obj = json.loads(c, cls=maker) @@ -73,16 +79,30 @@ def main(): json5_obj = json5.loads(c) end = time.time() - json_time = mid - start - json5_time = end - mid - times.append((json_time, json5_time)) - assert(json5_obj == json_obj) - all_times.append(times) - - for i, times in enumerate(all_times): - avg = sum((json5_time / json_time) - for json_time, json5_time in times) / args.num_iterations - print("%-20s: %5.1f" % (args.benchmarks[i], avg)) + json_time += mid - start + json5_time += end - mid + assert json5_obj == json_obj + all_times.append((json_time, json5_time)) + + for i, (json_time, json5_time) in enumerate(all_times): + fname = os.path.basename(args.benchmarks[i]) + if json5_time and json_time: + if json5_time > json_time: + avg = json5_time / json_time + print("%-20s: JSON was %5.1fx faster (%.6fs to %.6fs)" % ( + fname, avg, json_time, json5_time)) + else: + avg = json_time / json5_time + print("%-20s: JSON5 was %5.1fx faster (%.6fs to %.6fs)" % ( + fname, avg, json5_time, json_time)) + elif json5_time: + print("%-20s: JSON5 took %.6f secs, JSON was too fast to measure" % + (fname, json5_time)) + elif json_time: + print("%-20s: JSON took %.6f secs, JSON5 was too fast to measure" % + (fname, json_time)) + else: + print("%-20s: both were too fast to measure" % (fname,)) return 0 |