Don't rewrite it in Rust. Rewrite the 5% that's slow: profile your app, port the hot functions with your coding agent, prove they behave the same. Python, JS/TS, Ruby, Java, Kotlin, Go, PHP, C/C++, C#, R.
Rust agent-skillsai-agentsclaude-codeclaude-code-plugincodexdeveloper-toolsffimcpmcp-servernapi-rsnodejsoptimizationperformanceprofilerpyo3pythonrewrite-it-in-rustrubyrusttypescript
report: don't describe a switch when no port is enabled any more (#142)
EL4CTEO25c32972884b
diff --git a/src/report.rs b/src/report.rsindex d3b0597..b444d1c 100644--- a/src/report.rs+++ b/src/report.rs@@ -209,8 +209,12 @@ pub fn markdown(project: &str, b: &BenchResult, s: &State, on_device: &[Evidenceb.aa.median, b.aa.q1, b.aa.q3));}- md.push_str("\n\n\n| function | per call | checked against |\n|---|---|---|\n");- for p in enabled(s) {+ let on = enabled(s);+ md.push_str("\n\n");+ if !on.is_empty() {+ md.push_str("\n| function | per call | checked against |\n|---|---|---|\n");+ }+ for p in &on {let v = p.verify.clone().unwrap_or_default();let per_call = v.micro@@ -219,7 +223,14 @@ pub fn markdown(project: &str, b: &BenchResult, s: &State, on_device: &[Evidencemd.push_str(&format!("| `{}` | {per_call} | {}/{} recorded real calls |\n", p.id, v.passed, v.total));}md.push_str(&scan_section(s, b));- md.push_str("\nThe original code stays in place: set `FAST_ANYTHING_DISABLE=1` to run it, or `fast-anything disable <id>` to remove the switch.\n");+ if on.is_empty() {+ // ports switched off after the bench: there's no switch to describe (#142)+ let with =+ if b.ports.is_empty() { String::new() } else { format!(", with {} switched on", b.ports.join(", ")) };+ md.push_str(&format!("\nNo port is switched on now, so the app runs its original code: the numbers above are from the last bench{with}. `fast-anything enable <id>` switches a port back on.\n"));+ } else {+ md.push_str("\nThe original code stays in place: set `FAST_ANYTHING_DISABLE=1` to run it, or `fast-anything disable <id>` to remove the switch.\n");+ }if !on_device.is_empty() {md.push_str(&android::markdown(on_device, true));}@@ -305,6 +316,17 @@ mod tests {);}+ #[test]+ fn a_report_without_enabled_ports_says_so() {+ let b = BenchResult { speedup: 8.0, ports: vec!["fuzzy.lev".into()], ..BenchResult::default() };+ let md = markdown("app", &b, &State::default(), &[]);+ assert!(+ md.contains("No port is switched on now, so the app runs its original code: the numbers above are from the last bench, with fuzzy.lev switched on."),+ "{md}"+ );+ assert!(!md.contains("FAST_ANYTHING_DISABLE") && !md.contains("| function | per call"), "{md}");+ }+#[test]fn svg_is_escaped_and_scaled() {let b = BenchResult {