mirror of
https://github.com/godotengine/godot-benchmarks.git
synced 2026-01-06 14:10:20 +03:00
Improve docs and simplify/fix setup (#64)
This commit is contained in:
@@ -15,6 +15,9 @@ which runs benchmarks on a dedicated server with various GPU models.
|
|||||||
- GPU (Intel, release template)
|
- GPU (Intel, release template)
|
||||||
- GPU (NVIDIA, release template)
|
- GPU (NVIDIA, release template)
|
||||||
-->
|
-->
|
||||||
|
- The produced results (as .json or .md) should be copied into the `src-data/benchmarks` folder.
|
||||||
|
- The [./generate-content.py script](./generate-content.py) produces `.md` files
|
||||||
|
in the `content` folder, so that web pages can be generated for each graph and each benchmark.
|
||||||
- [Hugo](https://gohugo.io/) is used to create a homepage listing recent
|
- [Hugo](https://gohugo.io/) is used to create a homepage listing recent
|
||||||
benchmarked commits, plus a single page per engine commit. This allows linking
|
benchmarked commits, plus a single page per engine commit. This allows linking
|
||||||
to individual benchmarked commit in a future-proof way.
|
to individual benchmarked commit in a future-proof way.
|
||||||
@@ -26,10 +29,13 @@ which runs benchmarks on a dedicated server with various GPU models.
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
- Create JSON data or fetch existing JSON data from the live website.
|
- Create JSON data or fetch existing JSON data from the live website, and copy the JSON files into
|
||||||
- Save this JSON data to the `content` folder with the following naming convention:
|
the `src-data/benchmarks` folder. Files should be named using format `YYYY-MM-DD_hash.json` where
|
||||||
`YYYY-MM-DD_hash.json` where `hash` is a 9-character Git commit hash of the
|
`hash` is a 9-character Git commit hash of the Godot build used (truncated from a full commit hash).
|
||||||
Godot build used (truncated from a full commit hash).
|
The files can also have the `.md` extension (for backward compatibility), but they should still be
|
||||||
|
JSON inside.
|
||||||
|
- Run [./generate-content.py](./generate-content.py). This should create `.md` pages in both the
|
||||||
|
`content/benchmark` and the `content/graph` folders.
|
||||||
- Run `hugo server`.
|
- Run `hugo server`.
|
||||||
|
|
||||||
## Production
|
## Production
|
||||||
|
|||||||
0
web/data/.gitkeep
Normal file
0
web/data/.gitkeep
Normal file
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
from os import listdir
|
import os
|
||||||
from os.path import isdir, isfile, join
|
from os.path import isdir, isfile, join
|
||||||
|
|
||||||
# Source data paths.
|
# Source data paths.
|
||||||
@@ -40,7 +40,7 @@ data_output_json = {
|
|||||||
# Fetch the list of benchmark files
|
# Fetch the list of benchmark files
|
||||||
benchmark_input_filename_test = lambda f: (f.endswith(".json") or f.endswith(".md"))
|
benchmark_input_filename_test = lambda f: (f.endswith(".json") or f.endswith(".md"))
|
||||||
benchmarks_files = [
|
benchmarks_files = [
|
||||||
f for f in listdir(benchmarks_path) if (isfile(join(benchmarks_path, f)) and benchmark_input_filename_test(f))
|
f for f in os.listdir(benchmarks_path) if (isfile(join(benchmarks_path, f)) and benchmark_input_filename_test(f))
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add the list of benchmarks.
|
# Add the list of benchmarks.
|
||||||
@@ -48,7 +48,7 @@ for f in benchmarks_files:
|
|||||||
json_file = open(join(benchmarks_path, f))
|
json_file = open(join(benchmarks_path, f))
|
||||||
|
|
||||||
# Extract data from filename.
|
# Extract data from filename.
|
||||||
key = f.removesuffix(".json")
|
key = f.removesuffix(".json").removesuffix(".md")
|
||||||
date = key.split("_")[0]
|
date = key.split("_")[0]
|
||||||
commit = key.split("_")[1]
|
commit = key.split("_")[1]
|
||||||
|
|
||||||
@@ -91,12 +91,16 @@ data_file.close()
|
|||||||
|
|
||||||
# Create a .md file for each benchmark.
|
# Create a .md file for each benchmark.
|
||||||
benchmarks_content_path = "./content/benchmark"
|
benchmarks_content_path = "./content/benchmark"
|
||||||
|
if not os.path.exists(benchmarks_content_path):
|
||||||
|
os.mkdir(benchmarks_content_path)
|
||||||
for benchmark in data_output_json["benchmarks"]:
|
for benchmark in data_output_json["benchmarks"]:
|
||||||
filename = benchmark["date"] + "_" + benchmark["commit"] + ".md"
|
filename = benchmark["date"] + "_" + benchmark["commit"] + ".md"
|
||||||
open(join(benchmarks_content_path, filename), "a").close()
|
open(join(benchmarks_content_path, filename), "a").close()
|
||||||
|
|
||||||
# Create a .md file for each graph.
|
# Create a .md file for each graph.
|
||||||
graphs_content_path = "./content/graph"
|
graphs_content_path = "./content/graph"
|
||||||
|
if not os.path.exists(graphs_content_path):
|
||||||
|
os.mkdir(graphs_content_path)
|
||||||
for graph in data_output_json["graphs"]:
|
for graph in data_output_json["graphs"]:
|
||||||
filename = graph["id"] + ".md"
|
filename = graph["id"] + ".md"
|
||||||
open(join(graphs_content_path, filename), "a").close()
|
open(join(graphs_content_path, filename), "a").close()
|
||||||
|
|||||||
0
web/src-data/benchmarks/.gitkeep
Normal file
0
web/src-data/benchmarks/.gitkeep
Normal file
Reference in New Issue
Block a user