-
Notifications
You must be signed in to change notification settings - Fork 286
poc: don't write empty nodes #985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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? |
This is more like a Proof of concept about not writing nodes.
But it's very bad great for performance