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 all: update tools that manage copyright headers 2 years ago
build-webclient client/web: precompress assets 12 months ago
cloner all: use Go 1.22 range-over-int 7 months ago
connector-gen cmd/connector-gen: add helper tool for wide app connector configurations 11 months ago
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 util/cmpx: delete now that we're using Go 1.22 9 months ago
gitops-pusher cmd/gitops-pusher: only use OAuth creds if non-empty string 9 months ago
hello cmd/hello: link to the Hello KB article (#11022) 10 months ago
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 cmd/mkmanifest, cmd/tailscale, cmd/tailscaled: remove Windows arm32 resources from OSS 2 years ago
mkpkg go.mod: upgrade nfpm to v2 (#8786) 1 year ago
mkversion version/mkversion: open-source version generation logic 2 years ago
nardump all: update copyright and license headers 2 years ago
natc cmd/natc: add --wg-port flag 6 months ago
netlogfmt all: use Go 1.22 range-over-int 7 months ago
nginx-auth tailcfg,all: add and use Node.IsTagged() 2 years ago
pgproxy tsnet: split user facing and backend logging 6 months ago
printdep cmd/printdep: print correct toolchain URL 2 years ago
proxy-to-grafana all: use Go 1.22 range-over-int 7 months ago
sniproxy all: use math/rand/v2 more 6 months ago
speedtest all: update copyright and license headers 2 years ago
ssh-auth-none-demo all: replace deprecated ioutil references 1 year ago
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 all: adjust some build tags for plan9 1 year ago
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 cmd/testwrapper: apply results of all unit tests to coverage for all packages 9 months ago
tsconnect all: use math/rand/v2 more 6 months ago
tsidp tsnet: split user facing and backend logging 6 months ago
tsshd all: update copyright and license headers 2 years ago
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