internal/marshal: marshal is extremely inefficient #38
Labels
No Label
bug
CI
documentation
duplicate
enhancement
good first issue
help wanted
i18n
invalid
needs-investigation
ops
proposal
proposal-accepted
proposal-declined
question
refactor
security
testing
upstream
wontfix
Kind: Breaking
Kind: Bug
Kind: Documentation
Kind: Enhancement
Kind: Feature
Kind: Maintenance
Kind: Question
Kind: Security
Kind: Testing
Priority: Critical
Priority: High
Priority: Low
Priority: Medium
Reviewed: Confirmed
Reviewed: Duplicate
Reviewed: Invalid
Status: Blocked
Status: Completed
Status: Help wanted
Status: In progress
Status: Needs feedback
Status: Stale
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: mellium/xmpp#38
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The code from
internal/marshal
is incredibly inefficient due to limitations inencoding/xml
because it currently has to create a buffer, encode XML, then decode the XML it just created from the buffer:ad06d1aac2/internal/marshal/encode.go (L18-L26)
To fix this we should either:
encoding/xml
to also support token encoders (see previous experiments at https://golang.org/cl/127476 and https://golang.org/cl/127415)mellium.im/xmlstream
module and run it against the Go standard library tests to make sure it outputs the same thingIf we do option 2, it should be developed in
internal/
and then moved toxmlstream
once it has been verified and used more extensively. If we do option 1 a temporary workaround that uses the token encoder on versions of Go that support it and falls back to the current hack should be added and an issue created reminding us to remove the hack when all supported versions of Go contain the token writer APIs.Other suggestions for how this could be improved are also welcome.
Remove the following line from the docs when fixed:
8ee3bc1f84/internal/marshal/encode.go (L16)