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
Avoid creating unused node features #4574
Conversation
Many node feature types are only used in some very specific situations, e.g. only if an element has virtual children. Reduce memory overhead by not allocating such instances until some data will actually be saved in them. Reduces BasicElementView memory use from 219100 to 149909 bytes and the memory use in BeverageBuddy with an edit dialog open from 170041 to 151733 bytes.
} | ||
|
||
@Override | ||
public void removeAttribute(StateNode node, String attribute) { | ||
assert attribute != null; | ||
assert attribute.equals(attribute.toLowerCase(Locale.ENGLISH)); | ||
|
||
getAttributeFeature(node).remove(attribute); | ||
getAttributeFeatureIfInitialized(node) | ||
.map(feature -> feature.remove(attribute)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SonarQube analysis reported 5 issues Watch the comments in this conversation to review them. 4 extra issuesNote: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 12 of 12 files at r1.
Reviewable status: 1 unresolved discussion, 0 of 1 LGTMs obtained, and 1 stale
flow-server/src/main/java/com/vaadin/flow/dom/impl/BasicElementStateProvider.java, line 212 at r1 (raw file):
ifPresent
might be less confusing indeed, but it's too minor to deal with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @vaadin-bot from a discussion.
Reviewable status: complete! all discussions resolved, 1 of 1 LGTMs obtained
Many node feature types are only used in some very specific situations,
e.g. only if an element has virtual children. Reduce memory overhead by
not allocating such instances until some data will actually be saved in
them.
Reduces BasicElementView memory use from 219100 to 149909 bytes and the
memory use in BeverageBuddy with an edit dialog open from 170041 to
151733 bytes.
This change is