You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/cmd
Brad Fitzpatrick 64ac64fb66 net/tsaddr: use bart in NewContainsIPFunc, add tests, benchmarks
NewContainsIPFunc was previously documented as performing poorly if
there were many netip.Prefixes to search over. As such, we never it used it
in such cases.

This updates it to use bart at a certain threshold (over 6 prefixes,
currently), at which point the bart lookup overhead pays off.

This is currently kinda useless because we're not using it. But now we
can and get wins elsewhere. And we can remove the caveat in the docs.

    goos: darwin
    goarch: arm64
    pkg: tailscale.com/net/tsaddr
                                     │    before    │                after                 │
                                     │    sec/op    │    sec/op     vs base                │
    NewContainsIPFunc/empty-8          2.215n ± 11%   2.239n ±  1%   +1.08% (p=0.022 n=10)
    NewContainsIPFunc/cidr-list-1-8    17.44n ±  0%   17.59n ±  6%   +0.89% (p=0.000 n=10)
    NewContainsIPFunc/cidr-list-2-8    27.85n ±  0%   28.13n ±  1%   +1.01% (p=0.000 n=10)
    NewContainsIPFunc/cidr-list-3-8    36.05n ±  0%   36.56n ± 13%   +1.41% (p=0.000 n=10)
    NewContainsIPFunc/cidr-list-4-8    43.73n ±  0%   44.38n ±  1%   +1.50% (p=0.000 n=10)
    NewContainsIPFunc/cidr-list-5-8    51.61n ±  2%   51.75n ±  0%        ~ (p=0.101 n=10)
    NewContainsIPFunc/cidr-list-10-8   95.65n ±  0%   68.92n ±  0%  -27.94% (p=0.000 n=10)
    NewContainsIPFunc/one-ip-8         4.466n ±  0%   4.469n ±  1%        ~ (p=0.491 n=10)
    NewContainsIPFunc/two-ip-8         8.002n ±  1%   7.997n ±  4%        ~ (p=0.697 n=10)
    NewContainsIPFunc/three-ip-8       27.98n ±  1%   27.75n ±  0%   -0.82% (p=0.012 n=10)
    geomean                            19.60n         19.07n         -2.71%

Updates #12486

Change-Id: I2e2320cc4384f875f41721374da536bab995c1ce
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
5 months ago
..
addlicense
build-webclient
cloner all: use Go 1.22 range-over-int 7 months ago
connector-gen
containerboot ipn/{ipnlocal,localapi},net/netkernelconf,client/tailscale,cmd/containerboot: optionally enable UDP GRO forwarding for containers (#12410) 5 months ago
derper net/tsaddr: use bart in NewContainsIPFunc, add tests, benchmarks 5 months ago
derpprobe cmd/derpprobe: support 'local' derpmap to get derp map via LocalAPI 5 months ago
dist release/dist/qnap: add qnap target builder 7 months ago
get-authkey
gitops-pusher
hello
k8s-nameserver cmd/k8s-nameserver: fix AAAA record query response (#12412) 5 months ago
k8s-operator tsnet: fix error formatting bug 5 months ago
mkmanifest
mkpkg
mkversion
nardump
natc cmd/natc: add --wg-port flag 5 months ago
netlogfmt all: use Go 1.22 range-over-int 7 months ago
nginx-auth
pgproxy tsnet: split user facing and backend logging 6 months ago
printdep
proxy-to-grafana all: use Go 1.22 range-over-int 7 months ago
sniproxy all: use math/rand/v2 more 5 months ago
speedtest
ssh-auth-none-demo
stunc cmd/stunc: support user-specified port (#12469) 5 months ago
stund net/tsaddr: use bart in NewContainsIPFunc, add tests, benchmarks 5 months ago
stunstamp cmd/stunstamp: support probing multiple ports (#12356) 5 months ago
sync-containers
tailscale net/tsaddr: use bart in NewContainsIPFunc, add tests, benchmarks 5 months ago
tailscaled various: create a catch-all NRPT rule when "Override local DNS" is enabled on Windows 5 months ago
testcontrol all: use Go 1.22 range-over-int 7 months ago
testwrapper
tsconnect all: use math/rand/v2 more 5 months ago
tsidp tsnet: split user facing and backend logging 6 months ago
tsshd
viewer cmd/viewer,type/views: add MapSlice for maps of slices 5 months ago
xdpderper derp/xdp,cmd/xdpderper: initial skeleton (#12390) 5 months ago