VectorCraft: An open-source, vector art tool written by scratch in pure Rust
perf --deep: the embedded-picture import row reports a failed import instead of timing it
Drew Dibblea7ee168efe27
diff --git a/apps/vectorcraft-cli/src/perf.rs b/apps/vectorcraft-cli/src/perf.rsindex ad7eab161..ef6f299f3 100644--- a/apps/vectorcraft-cli/src/perf.rs+++ b/apps/vectorcraft-cli/src/perf.rs@@ -301,9 +301,9 @@ fn deep(n: usize) -> Result<(), String> {}// An SVG with one embedded picture opened from its text, as picture-heavy SVGs come: the// importer's passes over the text before usvg reads it, most of which is the data URL. The- // picture is the synthetic page drawn at 1.25x (about a megabyte as a PNG, the size at which- // the passes were measured); the hidden rectangle is a marker, so the prepass walks the tree- // as it does for a file that has one, instead of returning at its first check.+ // picture is the synthetic page drawn at 1.25x (about 2 MB as a PNG; the row names its size);+ // the hidden rectangle is a marker, so the prepass walks the tree as it does for a file that+ // has one, instead of returning at its first check.{let k = 1.25;let (w, h) = ((SYNTHETIC_PAGE.0 * k).round() as u32, (SYNTHETIC_PAGE.1 * k).round() as u32);@@ -312,9 +312,13 @@ fn deep(n: usize) -> Result<(), String> {let svg = format!(r#"<svg xmlns="http://www.w3.org/2000/svg" width="{w}" height="{h}"><image width="{w}" height="{h}" href="data:image/png;base64,{data}"/><rect width="100" height="100" style="display:none"/></svg>"#);+ // One import checked first, so a failure is reported rather than timed; the same text+ // imports the same way each time. Its document is kept for the memory reading.+ let imported = vectorcraft_svg::import_with_report(&svg).map_err(|e| e.to_string())?;let ms = median_ms(5, || drop(vectorcraft_svg::import_with_report(&svg)));rows.push((format!("import SVG, one embedded {} KB PNG", photo.len() / 1024), ms));note("after the import of an embedded picture");+ drop(imported);}// Output hashes, to compare builds: the SVG export and a save → open → save round trip.let fnv = |b: &[u8]| b.iter().fold(0xcbf2_9ce4_8422_2325u64, |h, &x| (h ^ u64::from(x)).wrapping_mul(0x100_0000_01b3));