tailscale/wgengine
Josh Bleecher Snyder ceaaa23962 wgengine/wglog: cache strings
We repeat many peers each time we call SetPeers.
Instead of constructing strings for them from scratch every time,
keep strings alive across iterations.

name        old time/op    new time/op    delta
SetPeers-8    3.58µs ± 1%    2.41µs ± 1%  -32.60%  (p=0.000 n=9+10)

name        old alloc/op   new alloc/op   delta
SetPeers-8    2.53kB ± 0%    1.30kB ± 0%  -48.73%  (p=0.000 n=10+10)

name        old allocs/op  new allocs/op  delta
SetPeers-8      99.0 ± 0%      16.0 ± 0%  -83.84%  (p=0.000 n=10+10)

We could reduce alloc/op 12% and allocs/op 23% if strs had
type map[string]strCache instead of map[string]*strCache,
but that wipes out the execution time impact.
Given that re-use is the most common scenario, let's optimize for it.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24 18:41:54 -07:00
..
bench all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
filter all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
magicsock all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
monitor all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
netstack all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
router all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
wgcfg all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
wglog wgengine/wglog: cache strings 2021-05-24 18:41:54 -07:00
winnet wgengine/winnet: don't build on non-windows 2021-02-09 21:09:24 -08:00
mem_ios.go go.mod: update wireguard-go, taking control over iOS memory usage from our fork 2021-05-24 12:03:57 -07:00
pendopen.go all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
userspace_ext_test.go cmd/tailscaled, wgengine{,/netstack}: add netstack hybrid mode, add to Windows 2021-04-06 21:37:28 -07:00
userspace_test.go all: adapt to opaque netaddr types 2021-05-16 14:52:00 -07:00
userspace.go wgengine: pass an addressable value to deephash.UpdateHash 2021-05-24 13:51:23 -07:00
watchdog_test.go wgengine: extend TestWatchdog timeout on macOS 2021-03-27 09:27:11 -07:00
watchdog.go wgengine: take in dns.Config, split out to resolver.Config and dns.OSConfig. 2021-04-02 00:59:44 -07:00
wgengine.go tailcfg: add Endpoint, EndpointType, MapRequest.EndpointType 2021-04-13 10:12:14 -07:00