Commit 68edc965 authored by Steven Allen's avatar Steven Allen

feat: reduce allocations

After profiling allocations on a bootstrap node, I've noticed that
peerInfoToPBPeer is a very heavy source of allocations. This change should
improve the situation significantly.
parent 6edcea2f
package dht_pb
import (
"encoding/json"
)
type byteString string
func (b byteString) Marshal() ([]byte, error) {
return []byte(b), nil
}
func (b *byteString) MarshalTo(data []byte) (int, error) {
return copy(data, *b), nil
}
func (b *byteString) Unmarshal(data []byte) error {
*b = byteString(data)
return nil
}
func (b *byteString) Size() int {
return len(*b)
}
func (b byteString) MarshalJSON() ([]byte, error) {
return json.Marshal([]byte(b))
}
func (b *byteString) UnmarshalJSON(data []byte) error {
var buf []byte
err := json.Unmarshal(data, &buf)
if err != nil {
return err
}
*b = byteString(buf)
return nil
}
func (b byteString) Equal(other byteString) bool {
return b == other
}
......@@ -5,6 +5,7 @@ package dht_pb
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
pb "github.com/libp2p/go-libp2p-record/pb"
io "io"
......@@ -110,13 +111,13 @@ type Message struct {
Record *pb.Record `protobuf:"bytes,3,opt,name=record,proto3" json:"record,omitempty"`
// Used to return peers closer to a key in a query
// GET_VALUE, GET_PROVIDERS, FIND_NODE
CloserPeers []*Message_Peer `protobuf:"bytes,8,rep,name=closerPeers,proto3" json:"closerPeers,omitempty"`
CloserPeers []Message_Peer `protobuf:"bytes,8,rep,name=closerPeers,proto3" json:"closerPeers"`
// Used to return Providers
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
ProviderPeers []*Message_Peer `protobuf:"bytes,9,rep,name=providerPeers,proto3" json:"providerPeers,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
ProviderPeers []Message_Peer `protobuf:"bytes,9,rep,name=providerPeers,proto3" json:"providerPeers"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Message) Reset() { *m = Message{} }
......@@ -180,14 +181,14 @@ func (m *Message) GetRecord() *pb.Record {
return nil
}
func (m *Message) GetCloserPeers() []*Message_Peer {
func (m *Message) GetCloserPeers() []Message_Peer {
if m != nil {
return m.CloserPeers
}
return nil
}
func (m *Message) GetProviderPeers() []*Message_Peer {
func (m *Message) GetProviderPeers() []Message_Peer {
if m != nil {
return m.ProviderPeers
}
......@@ -196,7 +197,7 @@ func (m *Message) GetProviderPeers() []*Message_Peer {
type Message_Peer struct {
// ID of a given peer.
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id byteString `protobuf:"bytes,1,opt,name=id,proto3,customtype=byteString" json:"id"`
// multiaddrs for a given peer
Addrs [][]byte `protobuf:"bytes,2,rep,name=addrs,proto3" json:"addrs,omitempty"`
// used to signal the sender's connection capabilities to the peer
......@@ -239,13 +240,6 @@ func (m *Message_Peer) XXX_DiscardUnknown() {
var xxx_messageInfo_Message_Peer proto.InternalMessageInfo
func (m *Message_Peer) GetId() []byte {
if m != nil {
return m.Id
}
return nil
}
func (m *Message_Peer) GetAddrs() [][]byte {
if m != nil {
return m.Addrs
......@@ -270,34 +264,37 @@ func init() {
func init() { proto.RegisterFile("dht.proto", fileDescriptor_616a434b24c97ff4) }
var fileDescriptor_616a434b24c97ff4 = []byte{
// 428 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xc1, 0x6e, 0x9b, 0x40,
0x10, 0xed, 0x02, 0x76, 0xe3, 0x01, 0x93, 0xcd, 0x28, 0x07, 0x94, 0x4a, 0x16, 0xf2, 0x89, 0x1e,
0x02, 0x12, 0x95, 0x7a, 0xe8, 0xa1, 0x92, 0x0b, 0x34, 0xb2, 0x94, 0x62, 0x6b, 0xeb, 0xa4, 0x47,
0xcb, 0xc0, 0xca, 0x41, 0xa5, 0x5e, 0x04, 0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0x3f, 0xa7, 0x02, 0x00, 0x00,
// 469 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xb1, 0x6f, 0x9b, 0x40,
0x18, 0xc5, 0x73, 0x80, 0xdd, 0xf8, 0x03, 0x3b, 0xe4, 0x94, 0x01, 0xb9, 0x92, 0x83, 0x3c, 0xd1,
0xc1, 0x20, 0xd1, 0xb5, 0xaa, 0x6a, 0x03, 0x8d, 0x2c, 0xa5, 0xd8, 0xba, 0x38, 0xe9, 0x68, 0x19,
0xb8, 0x12, 0x54, 0xd7, 0x87, 0x00, 0xa7, 0xf2, 0xd6, 0x3f, 0x2f, 0x63, 0xe7, 0x0e, 0x51, 0xe5,
0xa9, 0x7f, 0x46, 0xc5, 0x11, 0x5a, 0xec, 0x25, 0x13, 0xef, 0x7d, 0xf7, 0x7e, 0xe2, 0xdd, 0xa7,
0x83, 0x4e, 0x74, 0x5f, 0x98, 0x69, 0xc6, 0x0a, 0x86, 0xdb, 0x5c, 0x06, 0x7d, 0x3b, 0x4e, 0x8a,
0xfb, 0x6d, 0x60, 0x86, 0xec, 0x9b, 0xb5, 0x4e, 0x82, 0xd4, 0x4e, 0xad, 0x98, 0x8d, 0x2a, 0x35,
0xca, 0x68, 0xc8, 0xb2, 0xc8, 0x4a, 0x03, 0xab, 0x52, 0x15, 0xdb, 0x1f, 0x35, 0x98, 0x98, 0xc5,
0xcc, 0xe2, 0xe3, 0x60, 0xfb, 0x85, 0x3b, 0x6e, 0xb8, 0xaa, 0xe2, 0xc3, 0x3f, 0x12, 0xbc, 0xfa,
0x44, 0xf3, 0x7c, 0x15, 0x53, 0x6c, 0x81, 0x54, 0xec, 0x52, 0xaa, 0x21, 0x1d, 0x19, 0x3d, 0xfb,
0xb5, 0x59, 0xb5, 0x30, 0x9f, 0x8f, 0xeb, 0xef, 0x62, 0x97, 0x52, 0xc2, 0x83, 0xd8, 0x80, 0xb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 0x65, 0xec, 0xba, 0xcb, 0x39, 0x99, 0xdd,
0x4d, 0x5d, 0x8f, 0xa8, 0x02, 0x3e, 0x87, 0x6e, 0x19, 0xa8, 0x27, 0x37, 0xaa, 0x58, 0x32, 0x1f,
0xa7, 0xbe, 0xbb, 0xf4, 0x67, 0xae, 0xa7, 0x4a, 0xf8, 0x14, 0xa4, 0xf9, 0xd4, 0xbf, 0x52, 0x5b,
0xc3, 0xcf, 0xd0, 0x3b, 0x2c, 0x52, 0xd2, 0xfe, 0x6c, 0xb1, 0x74, 0x66, 0xbe, 0xef, 0x39, 0x0b,
0xcf, 0xad, 0xfe, 0xf8, 0xdf, 0x22, 0x7c, 0x06, 0xb2, 0x33, 0xf6, 0xeb, 0x84, 0x2a, 0x60, 0x0c,
0x3d, 0x67, 0xec, 0x37, 0x28, 0x55, 0x9c, 0x28, 0x8f, 0xfb, 0x01, 0xfa, 0xb9, 0x1f, 0xa0, 0xdf,
0xfb, 0x01, 0x0a, 0xda, 0xfc, 0xfd, 0xbd, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x1a, 0xa1,
0xbe, 0xf7, 0x02, 0x00, 0x00,
}
func (m *Message) Marshal() (dAtA []byte, err error) {
......@@ -422,13 +419,16 @@ func (m *Message_Peer) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x12
}
}
if len(m.Id) > 0 {
i -= len(m.Id)
copy(dAtA[i:], m.Id)
i = encodeVarintDht(dAtA, i, uint64(len(m.Id)))
i--
dAtA[i] = 0xa
{
size := m.Id.Size()
i -= size
if _, err := m.Id.MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintDht(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
......@@ -487,10 +487,8 @@ func (m *Message_Peer) Size() (n int) {
}
var l int
_ = l
l = len(m.Id)
if l > 0 {
n += 1 + l + sovDht(uint64(l))
}
l = m.Id.Size()
n += 1 + l + sovDht(uint64(l))
if len(m.Addrs) > 0 {
for _, b := range m.Addrs {
l = len(b)
......@@ -659,7 +657,7 @@ func (m *Message) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.CloserPeers = append(m.CloserPeers, &Message_Peer{})
m.CloserPeers = append(m.CloserPeers, Message_Peer{})
if err := m.CloserPeers[len(m.CloserPeers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
......@@ -693,7 +691,7 @@ func (m *Message) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProviderPeers = append(m.ProviderPeers, &Message_Peer{})
m.ProviderPeers = append(m.ProviderPeers, Message_Peer{})
if err := m.ProviderPeers[len(m.ProviderPeers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
......@@ -800,9 +798,8 @@ func (m *Message_Peer) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...)
if m.Id == nil {
m.Id = []byte{}
if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
......@@ -938,9 +935,6 @@ func skipDht(dAtA []byte) (n int, err error) {
return 0, ErrInvalidLengthDht
}
iNdEx += length
if iNdEx < 0 {
return 0, ErrInvalidLengthDht
}
case 3:
depth++
case 4:
......@@ -953,6 +947,9 @@ func skipDht(dAtA []byte) (n int, err error) {
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthDht
}
if depth == 0 {
return iNdEx, nil
}
......
......@@ -9,6 +9,7 @@ syntax = "proto3";
package dht.pb;
import "github.com/libp2p/go-libp2p-record/pb/record.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
message Message {
enum MessageType {
......@@ -37,7 +38,7 @@ message Message {
message Peer {
// ID of a given peer.
bytes id = 1;
bytes id = 1 [(gogoproto.customtype) = "byteString", (gogoproto.nullable) = false];
// multiaddrs for a given peer
repeated bytes addrs = 2;
......@@ -63,9 +64,9 @@ message Message {
// Used to return peers closer to a key in a query
// GET_VALUE, GET_PROVIDERS, FIND_NODE
repeated Peer closerPeers = 8;
repeated Peer closerPeers = 8 [(gogoproto.nullable) = false];
// Used to return Providers
// GET_VALUE, ADD_PROVIDER, GET_PROVIDERS
repeated Peer providerPeers = 9;
repeated Peer providerPeers = 9 [(gogoproto.nullable) = false];
}
......@@ -25,43 +25,41 @@ func NewMessage(typ Message_MessageType, key []byte, level int) *Message {
return m
}
func peerRoutingInfoToPBPeer(p PeerRoutingInfo) *Message_Peer {
pbp := new(Message_Peer)
func peerRoutingInfoToPBPeer(p PeerRoutingInfo) Message_Peer {
var pbp Message_Peer
pbp.Addrs = make([][]byte, len(p.Addrs))
for i, maddr := range p.Addrs {
pbp.Addrs[i] = maddr.Bytes() // Bytes, not String. Compressed.
}
s := string(p.ID)
pbp.Id = []byte(s)
c := ConnectionType(p.Connectedness)
pbp.Connection = c
pbp.Id = byteString(p.ID)
pbp.Connection = ConnectionType(p.Connectedness)
return pbp
}
func peerInfoToPBPeer(p peer.AddrInfo) *Message_Peer {
pbp := new(Message_Peer)
func peerInfoToPBPeer(p peer.AddrInfo) Message_Peer {
var pbp Message_Peer
pbp.Addrs = make([][]byte, len(p.Addrs))
for i, maddr := range p.Addrs {
pbp.Addrs[i] = maddr.Bytes() // Bytes, not String. Compressed.
}
pbp.Id = []byte(p.ID)
pbp.Id = byteString(p.ID)
return pbp
}
// PBPeerToPeer turns a *Message_Peer into its peer.AddrInfo counterpart
func PBPeerToPeerInfo(pbp *Message_Peer) *peer.AddrInfo {
return &peer.AddrInfo{
ID: peer.ID(pbp.GetId()),
func PBPeerToPeerInfo(pbp Message_Peer) peer.AddrInfo {
return peer.AddrInfo{
ID: peer.ID(pbp.Id),
Addrs: pbp.Addresses(),
}
}
// RawPeerInfosToPBPeers converts a slice of Peers into a slice of *Message_Peers,
// ready to go out on the wire.
func RawPeerInfosToPBPeers(peers []peer.AddrInfo) []*Message_Peer {
pbpeers := make([]*Message_Peer, len(peers))
func RawPeerInfosToPBPeers(peers []peer.AddrInfo) []Message_Peer {
pbpeers := make([]Message_Peer, len(peers))
for i, p := range peers {
pbpeers[i] = peerInfoToPBPeer(p)
}
......@@ -72,7 +70,7 @@ func RawPeerInfosToPBPeers(peers []peer.AddrInfo) []*Message_Peer {
// which can be written to a message and sent out. the key thing this function
// does (in addition to PeersToPBPeers) is set the ConnectionType with
// information from the given network.Network.
func PeerInfosToPBPeers(n network.Network, peers []peer.AddrInfo) []*Message_Peer {
func PeerInfosToPBPeers(n network.Network, peers []peer.AddrInfo) []Message_Peer {
pbps := RawPeerInfosToPBPeers(peers)
for i, pbp := range pbps {
c := ConnectionType(n.Connectedness(peers[i].ID))
......@@ -81,8 +79,8 @@ func PeerInfosToPBPeers(n network.Network, peers []peer.AddrInfo) []*Message_Pee
return pbps
}
func PeerRoutingInfosToPBPeers(peers []PeerRoutingInfo) []*Message_Peer {
pbpeers := make([]*Message_Peer, len(peers))
func PeerRoutingInfosToPBPeers(peers []PeerRoutingInfo) []Message_Peer {
pbpeers := make([]Message_Peer, len(peers))
for i, p := range peers {
pbpeers[i] = peerRoutingInfoToPBPeer(p)
}
......@@ -91,10 +89,11 @@ func PeerRoutingInfosToPBPeers(peers []PeerRoutingInfo) []*Message_Peer {
// PBPeersToPeerInfos converts given []*Message_Peer into []peer.AddrInfo
// Invalid addresses will be silently omitted.
func PBPeersToPeerInfos(pbps []*Message_Peer) []*peer.AddrInfo {
func PBPeersToPeerInfos(pbps []Message_Peer) []*peer.AddrInfo {
peers := make([]*peer.AddrInfo, 0, len(pbps))
for _, pbp := range pbps {
peers = append(peers, PBPeerToPeerInfo(pbp))
ai := PBPeerToPeerInfo(pbp)
peers = append(peers, &ai)
}
return peers
}
......@@ -109,7 +108,7 @@ func (m *Message_Peer) Addresses() []ma.Multiaddr {
for _, addr := range m.Addrs {
maddr, err := ma.NewMultiaddrBytes(addr)
if err != nil {
log.Debugw("error decoding multiaddr for peer", "peer", m.GetId(), "error", err)
log.Debugw("error decoding multiaddr for peer", "peer", peer.ID(m.Id), "error", err)
continue
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment