Skip to content

Reduce decoder allocs due to int/uint decoding#356

Merged
guelfey merged 1 commit intogodbus:masterfrom
marselester:dec-allocs
Apr 8, 2023
Merged

Reduce decoder allocs due to int/uint decoding#356
guelfey merged 1 commit intogodbus:masterfrom
marselester:dec-allocs

Conversation

@marselester
Copy link
Contributor

Hi! I realized that it's possible to have zero allocations when decoding ints/uints. That's basically one less allocation per decoded string.

$ go test -benchmem -run=^$ -bench ^BenchmarkEncodeSliceInterface$
# new
BenchmarkEncodeSliceInterface-2   	  456021	      2731 ns/op	     700 B/op	      34 allocs/op
# old
BenchmarkEncodeSliceInterface-2   	  430402	      2826 ns/op	     732 B/op	      38 allocs/op

Copy link
Member

@guelfey guelfey left a comment

Choose a reason for hiding this comment

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

Thanks!

@guelfey guelfey merged commit c3f325f into godbus:master Apr 8, 2023
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