summaryrefslogtreecommitdiff
path: root/tools/benchmark.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/benchmark.py')
-rwxr-xr-xtools/benchmark.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/benchmark.py b/tools/benchmark.py
index 856ee3c85..943883f8f 100755
--- a/tools/benchmark.py
+++ b/tools/benchmark.py
@@ -25,7 +25,8 @@ exec_time_benchmarks = [
]
gh_pages_data_file = "gh-pages/data.json"
-data_file = "website/data.json"
+all_data_file = "website/data.json" # Includes all benchmark data.
+recent_data_file = "website/recent.json" # Includes recent 20 benchmark data.
def read_json(filename):
@@ -39,16 +40,16 @@ def write_json(filename, data):
def import_data_from_gh_pages():
- if os.path.exists(data_file):
+ if os.path.exists(all_data_file):
return
try:
run([
"git", "clone", "--depth", "1", "-b", "gh-pages",
"https://github.com/denoland/deno.git", "gh-pages"
])
- shutil.copy(gh_pages_data_file, data_file)
+ shutil.copy(gh_pages_data_file, all_data_file)
except:
- write_json(data_file, []) # writes empty json data
+ write_json(all_data_file, []) # writes empty json data
def get_binary_sizes(build_dir):
@@ -157,7 +158,7 @@ def main(argv):
run(["hyperfine", "--export-json", benchmark_file, "--warmup", "3"] + [
deno_path + " " + " ".join(args) for [_, args] in exec_time_benchmarks
])
- all_data = read_json(data_file)
+ all_data = read_json(all_data_file)
benchmark_data = read_json(benchmark_file)
sha1 = run_output(["git", "rev-parse", "HEAD"]).strip()
new_data = {
@@ -191,7 +192,8 @@ def main(argv):
new_data["syscall_count"] = run_syscall_count_benchmark(deno_path)
all_data.append(new_data)
- write_json(data_file, all_data)
+ write_json(all_data_file, all_data)
+ write_json(recent_data_file, all_data[-20:])
if __name__ == '__main__':