summaryrefslogtreecommitdiff
path: root/tools/build_benchmark_jsons.py
diff options
context:
space:
mode:
authorChristian Moritz <chrmoritz@users.noreply.github.com>2019-10-06 17:18:15 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-10-06 11:18:15 -0400
commit3e02d7ddbc04cf3bfc681a5f4cfe6b91a9860cbd (patch)
tree5ec3a415d8f13e784f74d593680c02c5fca8a9a8 /tools/build_benchmark_jsons.py
parentbed7034fc44a8d20e11a85b6092e7f0f34f43ff8 (diff)
refactor benchmark results posting (#3076)
Diffstat (limited to 'tools/build_benchmark_jsons.py')
-rwxr-xr-xtools/build_benchmark_jsons.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/build_benchmark_jsons.py b/tools/build_benchmark_jsons.py
new file mode 100755
index 000000000..1d7a03401
--- /dev/null
+++ b/tools/build_benchmark_jsons.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+from util import build_path
+from benchmark import read_json, write_json
+import os
+
+current_data_file = os.path.join(build_path(), "bench.json")
+gh_pages_data_file = "gh-pages/data.json"
+all_data_file = "website/data.json" # Includes all benchmark data.
+recent_data_file = "website/recent.json" # Includes recent 20 benchmark data.
+
+assert os.path.exists(current_data_file)
+assert os.path.exists(gh_pages_data_file)
+
+new_data = read_json(current_data_file)
+all_data = read_json(gh_pages_data_file)
+all_data.append(new_data)
+
+write_json(all_data_file, all_data)
+write_json(recent_data_file, all_data[-20:])