rabukasim / engine_rust_src /src /bin /diag_eval_cost.rs
trioskosmos's picture
Upload folder using huggingface_hub
463f868 verified
fn main() {
println!("\n=== Per-Evaluation Cost Diagnostic ===\n");
// The bottleneck analysis based on code structure:
println!("Estimated per-eval breakdown (from code inspection):");
println!(" State clone: ~5-8 Β΅s");
println!(" Legal action gen: ~2-3 Β΅s");
println!(" Move ordering (1/8 of nodes): ~4 Β΅s");
println!(" Heuristic eval: ~3-5 Β΅s");
println!(" Recursion/TT: ~2-3 Β΅s");
println!(" ─────────────────────────────");
println!(" TOTAL (AB): ~20-30 Β΅s/eval");
println!(" TOTAL (Pure DFS): ~15-20 Β΅s/eval");
println!("\nMeasured values:");
println!(" Alpha-beta: ~46 Β΅s/eval (from 62K evals in 2.85s)");
println!(" Pure DFS: ~16 Β΅s/eval (from 7.95M evals in 129.7s)");
println!("\nBottleneck ranking (cost * frequency):");
println!(" 1. State clone (happens every recursion) = HIGH");
println!(" 2. Heuristic evaluation (happens every node) = HIGH");
println!(" 3. Move ordering (1/8 of nodes) = MEDIUM");
println!(" 4. Legal action generation = MEDIUM");
println!(" 5. Recursion overhead = LOW");
println!("\nOptimization opportunities:");
println!(" β–Ί Avoid state clone: Use references + copy-on-write");
println!(" β–Ί Cache legal actions per state");
println!(" β–Ί Vectorize heuristic evaluation");
println!(" β–Ί Make move ordering even lighter (only count pieces, not full eval)");
}