2019-10-06 11:18:15 -04:00
|
|
|
#!/usr/bin/env python
|
2020-01-02 15:13:47 -05:00
|
|
|
# Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-01-05 09:19:29 -05:00
|
|
|
import os
|
2020-08-28 14:06:20 -04:00
|
|
|
import json
|
2019-10-06 11:18:15 -04:00
|
|
|
from util import build_path
|
2020-08-28 11:57:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
def read_json(filename):
|
|
|
|
with open(filename) as json_file:
|
|
|
|
return json.load(json_file)
|
|
|
|
|
|
|
|
|
|
|
|
def write_json(filename, data):
|
|
|
|
with open(filename, 'w') as outfile:
|
|
|
|
json.dump(data, outfile)
|
|
|
|
|
2019-10-06 11:18:15 -04:00
|
|
|
|
|
|
|
current_data_file = os.path.join(build_path(), "bench.json")
|
2019-10-24 16:14:05 -04:00
|
|
|
all_data_file = "gh-pages/data.json" # Includes all benchmark data.
|
|
|
|
recent_data_file = "gh-pages/recent.json" # Includes recent 20 benchmark data.
|
2019-10-06 11:18:15 -04:00
|
|
|
|
|
|
|
assert os.path.exists(current_data_file)
|
2019-10-24 16:14:05 -04:00
|
|
|
assert os.path.exists(all_data_file)
|
2019-10-06 11:18:15 -04:00
|
|
|
|
|
|
|
new_data = read_json(current_data_file)
|
2019-10-24 16:14:05 -04:00
|
|
|
all_data = read_json(all_data_file)
|
2019-10-06 11:18:15 -04:00
|
|
|
all_data.append(new_data)
|
|
|
|
|
|
|
|
write_json(all_data_file, all_data)
|
|
|
|
write_json(recent_data_file, all_data[-20:])
|