Skip writing default attribute values in IIDM serialization#3826
Draft
clementleclercRTE wants to merge 28 commits intomainfrom
Draft
Skip writing default attribute values in IIDM serialization#3826clementleclercRTE wants to merge 28 commits intomainfrom
clementleclercRTE wants to merge 28 commits intomainfrom
Conversation
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…n XML, JSON, and binary serialization Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…ort for skipping extensions Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…ted unit tests Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
… cl-binary-named-attributes
… cl-binary-named-attributes
… methods via version-based logic Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…erDe deserialization Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
… cl-binary-named-attributes
… cl-binary-named-attributes
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…e' into cl-default_attribute_values_SerDe # Conflicts: # iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/AbstractTransformerSerDe.java
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
Signed-off-by: Leclerc Clement <clement.leclerc@rte-france.com>
…e' into cl-default_attribute_values_SerDe # Conflicts: # iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/GeneratorSerDe.java # iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/LineSerDe.java # iidm/iidm-serde/src/main/java/com/powsybl/iidm/serde/TwoWindingsTransformerSerDe.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
What kind of change does this PR introduce?
Performance feature: reduction of serialized file size by omitting attributes equal to their default value.
What is the current behavior?
Every attribute is always written during serialization, even when its value equals the defined default. This produces unnecessarily verbose output, especially for tap changer steps (4 attributes
r, x, g, b almost always zero), switches (retained/open typically false), and transformer/line shunt parameters (g, b typically zero). On large networks this has a measurable impact on file size
and I/O performance, particularly for the binary serialization format.
What is the new behavior (if this is a feature change)?
Attributes whose value equals their default are omitted from the serialized output. The read side is unaffected: all readers already use readDoubleAttribute(name,defaultValue) / readBooleanAttribute(name, defaultValue), which transparently return the default when an attribute is absent.
Versions ≤ 1.16 are unchanged — all attributes continue to be written unconditionally, preserving full backward compatibility.
For the binary format, this PR requires PR #3804, which makes the binary reader order-independent and tolerant of absent attributes.
Full list of attributes now omitted when equal to their default :
Does this PR introduce a breaking change or deprecate an API?
If yes, please check if the following requirements are fulfilled
What changes might users need to make in their application due to this PR? (migration steps)
Other information:
The internal method writeTapChangerStep in AbstractTransformerSerDe had its signature changed from (TapChangerStep, TreeDataWriter) to (TapChangerStep, NetworkSerializerContext) in order to access
the IIDM version inside that method for the version guard. This is a package-private refactoring with no impact on the public API.