adjusted global score calculation

This commit is contained in:
2026-08-08 12:41:49 +02:00
parent e28e844967
commit c10cd7d47f
3 changed files with 480 additions and 557 deletions
Generated
+436 -544
View File
File diff suppressed because it is too large Load Diff
Generated
+3 -3
View File
@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1764950072,
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
"lastModified": 1785967620,
"narHash": "sha256-IItrdb7Puk05RqOBWZYFC5X6Wl1sJmCfh5MWVHw5iMM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f61125a668a320878494449750330ca58b78c557",
"rev": "b7c2ada94fe99c15b0dbcf4d11fd7850b957a436",
"type": "github"
},
"original": {
+41 -10
View File
@@ -113,15 +113,16 @@ fn process_reports(raw_reports: Vec<Report>) -> Vec<ReportRow> {
raw_reports
.into_iter()
.map(|s| {
let ram_raw = s
.slimes
.get("RAM")
.and_then(|v| v.first())
.map(|r| parse_total_ram_raw(r))
.unwrap_or(0.0);
let ram_raw = extract_ram_raw(&s);
let score = calculate_global_score(
s.benchmark.single_thread.score,
s.benchmark.multi_thread.score,
ram_raw,
);
ReportRow {
id: s.id,
score: (s.benchmark.multi_thread.score + s.benchmark.single_thread.score) / 2,
score,
single_score: s.benchmark.single_thread.score,
multi_score: s.benchmark.multi_thread.score,
cores: s.benchmark.logical_cores,
@@ -312,10 +313,15 @@ async fn render_details(
&format!("Report #{} | {}", report.id, state.app_name),
);
context.insert("time_ago", &format_time_ago(&report.timestamp));
context.insert(
"score",
&((report.benchmark.multi_thread.score + report.benchmark.single_thread.score) / 2),
let ram_raw = extract_ram_raw(&report);
let score = calculate_global_score(
report.benchmark.single_thread.score,
report.benchmark.multi_thread.score,
ram_raw,
);
context.insert("score", &score);
context.insert("current_page", "details");
context.insert("prefix", "../");
@@ -473,3 +479,28 @@ pub async fn analytics_handler(
Err(e) => Err((StatusCode::INTERNAL_SERVER_ERROR, e.to_string())),
}
}
fn extract_ram_raw(report: &Report) -> f32 {
report
.slimes
.get("RAM")
.and_then(|v| v.first())
.map(|r| parse_total_ram_raw(r))
.unwrap_or(0.0)
}
pub fn calculate_global_score(single: u64, multi: u64, ram_gb: f32) -> u64 {
if single == 0 || multi == 0 {
return 0;
}
let geom_mean: f64 = ((single as f64) * (multi as f64)).sqrt();
let ram_multiplier: f64 = if ram_gb > 0.0 {
(1.0 + (ram_gb.log2() * 0.32)).into()
} else {
1.0
};
(geom_mean * ram_multiplier) as u64
}