godbus / dbus

Native Go bindings for D-Bus
BSD 2-Clause "Simplified" License
959 stars 222 forks source link

Reduce allocs in decode function #344

Closed marselester closed 1 year ago

marselester commented 1 year ago

Hi! I tried to reduce memory allocations in the decode function to reduce GC pressure.

# new
BenchmarkEncodeSliceInterface-2       457238          2609 ns/op         732 B/op         38 allocs/op
# old
BenchmarkEncodeSliceInterface-2       434961          2706 ns/op         628 B/op         46 allocs/op

Apologies if I broke certain dbus protocol assumptions during refactoring, I am not very familiar with the codebase.

guelfey commented 1 year ago

Thanks!