poc: don't write empty nodes - #985
Its-Just-Nans wants to merge 6 commits into
Conversation
|
Any others ideas to not write empty nodes ? |
|
I'm also thinking on "start_svg_element" only when necessary, ie Beforexml.start_svg_element(EId::G);
if !g.id.is_empty() {
xml.write_id_attribute(&g.id, opt);
};
// ...
xml.end_element();Afterlet mut element_started = false;
if !g.id.is_empty() {
xml.start_svg_element(EId::G);
element_started = true;
xml.write_id_attribute(&g.id, opt);
};
// ...
if element_started {
xml.end_element();
} |
|
Hi @LaurenzV pinging you for question Do you think the second option ("after") is suitable? |
|
I'm not sure... But I can't say I'm a fan, to be honest. I'll try to think about it a bit more when I find some time. |
|
Probably there should be some method that based on the group node checks whether it will be empty, and then only do the check once. Otherwise, we would have to do the check every time we write a new attribute. |
I implemented the lazy writer version. What do you think about it? |
|
@LaurenzV can you look at this? Issue still exists in |
|
Sorry, unfortunately I just don't have much time for resvg currently. :/ |
This is more like a Proof of concept about not writing nodes.
But it's very bad great for performance