Merge pull request #310 from armansito/svg-timing

[svg] Log parse and render times separately
This commit is contained in:
Arman Uguray 2023-04-23 11:31:19 -07:00 committed by GitHub
commit fa027978ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,11 +93,13 @@ pub fn svg_function_of<R: AsRef<str>>(
let start = Instant::now();
let svg = usvg::Tree::from_str(&contents, &usvg::Options::default())
.expect("failed to parse svg file");
eprintln!("Parsed svg {name} in {:?}", start.elapsed());
let start = Instant::now();
let mut new_scene = SceneFragment::new();
let mut builder = SceneBuilder::for_fragment(&mut new_scene);
vello_svg::render_tree(&mut builder, &svg);
let resolution = Vec2::new(svg.size.width(), svg.size.height());
eprintln!("Rendered svg {name} in {:?}", start.elapsed());
eprintln!("Encoded svg {name} in {:?}", start.elapsed());
(new_scene, resolution)
}
let mut cached_scene = None;