Skip to content
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

Ignore empty text node when parsing XML nodes #3349

Merged
merged 2 commits into from
Dec 31, 2024

Conversation

nieqiurong
Copy link
Contributor

When parsing XML, since nested nodes have line breaks by default, these nodes should not be parsed as text nodes and added, which will cause unnecessary heap space to be occupied.

image

The test project reduces the creation of this node, and the space occupied by this node is reduced from 1625KB to 748KB

Snipaste_2024-12-29_14-04-38
Snipaste_2024-12-29_14-06-39

@coveralls
Copy link

coveralls commented Dec 29, 2024

Coverage Status

coverage: 87.33% (+0.02%) from 87.31%
when pulling 5c757a3 on nieqiurong:20241229
into e08b503 on mybatis:master.

@hazendaz hazendaz requested a review from harawata December 31, 2024 00:27
@hazendaz
Copy link
Member

@harawata Any concerns here? Its using trim so it handles all whitespace type which would probably be more appropriate title here.

@harawata harawata changed the title Skip newline characters in dynamic node parsing Ignore empty text node when parsing XML nodes Dec 31, 2024
@harawata harawata added the polishing Improve a implementation code or doc without change in current behavior/content label Dec 31, 2024
Copy link
Member

@harawata harawata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @nieqiurong ,

This seems like a good optimization without affecting the final SQL.
Nice work!

@hazendaz hazendaz merged commit 27ca11c into mybatis:master Dec 31, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polishing Improve a implementation code or doc without change in current behavior/content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants