adjusted global score calculation
This commit is contained in:
Generated
+436
-544
File diff suppressed because it is too large
Load Diff
Generated
+3
-3
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764950072,
|
"lastModified": 1785967620,
|
||||||
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=",
|
"narHash": "sha256-IItrdb7Puk05RqOBWZYFC5X6Wl1sJmCfh5MWVHw5iMM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "f61125a668a320878494449750330ca58b78c557",
|
"rev": "b7c2ada94fe99c15b0dbcf4d11fd7850b957a436",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
+41
-10
@@ -113,15 +113,16 @@ fn process_reports(raw_reports: Vec<Report>) -> Vec<ReportRow> {
|
|||||||
raw_reports
|
raw_reports
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
let ram_raw = s
|
let ram_raw = extract_ram_raw(&s);
|
||||||
.slimes
|
let score = calculate_global_score(
|
||||||
.get("RAM")
|
s.benchmark.single_thread.score,
|
||||||
.and_then(|v| v.first())
|
s.benchmark.multi_thread.score,
|
||||||
.map(|r| parse_total_ram_raw(r))
|
ram_raw,
|
||||||
.unwrap_or(0.0);
|
);
|
||||||
|
|
||||||
ReportRow {
|
ReportRow {
|
||||||
id: s.id,
|
id: s.id,
|
||||||
score: (s.benchmark.multi_thread.score + s.benchmark.single_thread.score) / 2,
|
score,
|
||||||
single_score: s.benchmark.single_thread.score,
|
single_score: s.benchmark.single_thread.score,
|
||||||
multi_score: s.benchmark.multi_thread.score,
|
multi_score: s.benchmark.multi_thread.score,
|
||||||
cores: s.benchmark.logical_cores,
|
cores: s.benchmark.logical_cores,
|
||||||
@@ -312,10 +313,15 @@ async fn render_details(
|
|||||||
&format!("Report #{} | {}", report.id, state.app_name),
|
&format!("Report #{} | {}", report.id, state.app_name),
|
||||||
);
|
);
|
||||||
context.insert("time_ago", &format_time_ago(&report.timestamp));
|
context.insert("time_ago", &format_time_ago(&report.timestamp));
|
||||||
context.insert(
|
|
||||||
"score",
|
let ram_raw = extract_ram_raw(&report);
|
||||||
&((report.benchmark.multi_thread.score + report.benchmark.single_thread.score) / 2),
|
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("current_page", "details");
|
||||||
context.insert("prefix", "../");
|
context.insert("prefix", "../");
|
||||||
|
|
||||||
@@ -473,3 +479,28 @@ pub async fn analytics_handler(
|
|||||||
Err(e) => Err((StatusCode::INTERNAL_SERVER_ERROR, e.to_string())),
|
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
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user