Skip to content

Commit

Permalink
Improve encoding marshal performance
Browse files Browse the repository at this point in the history
  • Loading branch information
zalegrala committed Sep 23, 2024
1 parent a9dc739 commit 3e87db4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tempodb/backend/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,8 @@ func (e Encoding) Marshal() ([]byte, error) {
}

func (e *Encoding) MarshalTo(data []byte) (n int, err error) {
b, err := e.Marshal()
if err != nil {
return 0, err
}

return copy(data, b), nil
data[0] = byte(*e)
return 1, nil
}

func (e *Encoding) Unmarshal(data []byte) error {
Expand Down

0 comments on commit 3e87db4

Please sign in to comment.