diff options
author | Jamie Liu <jamieliu@google.com> | 2020-03-13 12:20:09 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-03-13 12:22:19 -0700 |
commit | 86409c91813256f45ebcb08efeac9d7f9e56a804 (patch) | |
tree | 7507be8b78b3bc47fc70846e61725b729dbbd73c /pkg/tcpip/stack/nic.go | |
parent | b78cee3bae142eb5c602d51874d0cbad274777e2 (diff) |
Avoid unnecessary work in transportDemuxer.deliverPacket().
- Don't allocate []*endpointsByNic in transportDemuxer.deliverPacket() unless
actually needed for UDP broadcast/multicast.
- Don't allocate []*endpointsByNic via transportDemuxer.findEndpointLocked()
=> transportDemuxer.findAllEndpointsLocked().
- Skip unnecessary map lookups in transportDemuxer.findEndpointLocked() =>
transportDemuxer.findAllEndpointsLocked() (now iterEndpointsLocked).
For most deliverable packets other than UDP broadcast/multicast packets, this
saves two slice allocations and three map lookups per packet.
PiperOrigin-RevId: 300804135
Diffstat (limited to 'pkg/tcpip/stack/nic.go')
0 files changed, 0 insertions, 0 deletions