Skip to content

Reduce intermediate allocations during XML parse#166

Merged
rauhul merged 1 commit intomainfrom
xml-perf
Jun 11, 2025
Merged

Reduce intermediate allocations during XML parse#166
rauhul merged 1 commit intomainfrom
xml-perf

Conversation

@rauhul
Copy link
Collaborator

@rauhul rauhul commented Jun 11, 2025

Removes the additional indirection used SVD parsing which caused additional allocations. Overall this has a minor affect on performance but the code is more clear about ownership.

Removes the additional indirection used SVD parsing which caused
additional allocations. Overall this has a minor affect on performance
but the code is more clear about ownership.
Comment on lines +32 to +35
case .parsing(var stack):
let node = XMLElement(name: name)
stack.append(node)
self = .parsing(stack: stack)
Copy link
Member

Choose a reason for hiding this comment

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

This is cool – even though stack is a var here, it's the only reference to that array since self is consumed at this point.

@rauhul rauhul merged commit 2952ecc into main Jun 11, 2025
20 checks passed
@rauhul rauhul deleted the xml-perf branch June 11, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants