tailscale/util
Andrew Dunham 8e4a29433f util/pool: add package for storing and using a pool of items
This can be used to implement a persistent pool (i.e. one that isn't
cleared like sync.Pool is) of items–e.g. database connections.

Some benchmarks vs. a naive implementation that uses a single map
iteration show a pretty meaningful improvement:

    $ benchstat -col /impl ./bench.txt
    goos: darwin
    goarch: arm64
    pkg: tailscale.com/util/pool
                       │    Pool     │                   map                    │
                       │   sec/op    │     sec/op      vs base                  │
    Pool_AddDelete-10    10.56n ± 2%     15.11n ±  1%    +42.97% (p=0.000 n=10)
    Pool_TakeRandom-10   56.75n ± 4%   1899.50n ± 20%  +3246.84% (p=0.000 n=10)
    geomean              24.49n          169.4n         +591.74%

Updates tailscale/corp#19900

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: Ie509cb65573c4726cfc3da9a97093e61c216ca18
2024-05-24 14:11:19 -04:00
..
cache util/cache: fix missing interface methods (#11275) 2024-02-27 23:03:49 -05:00
cibuild all: update copyright and license headers 2023-01-27 15:36:29 -08:00
clientmetric util/clientmetric: allow client metric values to be provided by a function 2023-04-05 17:21:16 -07:00
cloudenv util/cloudenv: add support for DigitalOcean 2024-02-10 14:36:20 -05:00
cmpver util/cmpver: add Less/LessEq helper funcs 2024-03-05 16:57:04 +00:00
codegen all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
cstruct all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
ctxkey all: use reflect.TypeFor now available in Go 1.22 (#11078) 2024-02-08 17:34:22 -08:00
deephash all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
dirwalk all: use tstest.Replace more 2023-03-04 12:24:55 -08:00
dnsname all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
execqueue control/controlclient,util/execqueue: extract execqueue into a package 2024-01-18 12:08:13 -08:00
expvarx all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
fastuuid all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
goroutines util/goroutines: let ScrubbedGoroutineDump get only current stack 2023-06-23 12:50:45 -07:00
groupmember util/groupmember: fail earlier if group doesn't exist, use slices.Contains 2023-11-01 19:23:16 -07:00
hashx all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
httphdr util/httphdr: add new package for parsing HTTP headers (#9797) 2023-10-13 15:38:22 -07:00
httpm util/httpm: don't run test if .git doesn't exist 2023-11-22 12:09:59 -05:00
jsonutil all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
limiter all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
lineread all: update copyright and license headers 2023-01-27 15:36:29 -08:00
linuxfw util/linuxfw: fix IPv6 availability check for nftables (#12009) 2024-05-14 08:51:53 +01:00
lru util/lru: add Clear method 2024-05-17 20:01:40 -04:00
mak various: add golangci-lint, fix issues (#7905) 2023-04-17 18:38:24 -04:00
multierr all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
must all: update copyright and license headers 2023-01-27 15:36:29 -08:00
nocasemaps all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
osdiag ipn/local: log OS-specific diagnostic information as JSON (#11700) 2024-04-22 16:45:01 -07:00
osshare all: update copyright and license headers 2023-01-27 15:36:29 -08:00
osuser util/osuser: add unit test for parseGroupIds 2024-04-23 08:54:17 -05:00
pidowner all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
pool util/pool: add package for storing and using a pool of items 2024-05-24 14:11:19 -04:00
precompress all: update copyright and license headers 2023-01-27 15:36:29 -08:00
progresstracking ipn/localapi: add support for multipart POST to file-put 2024-03-27 08:53:52 -05:00
quarantine all: update copyright and license headers 2023-01-27 15:36:29 -08:00
race all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
racebuild all: update copyright and license headers 2023-01-27 15:36:29 -08:00
rands util/rands: add Shuffle and Perm functions with on-stack RNG state 2024-02-09 15:19:27 -08:00
reload util/reload: add new package to handle periodic value loading 2024-03-20 18:23:54 -04:00
ringbuffer all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
set util/set: add Of variant of SetOf that takes variadic parameter 2024-05-05 21:14:28 -07:00
singleflight all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
slicesx util/slicesx: add AppendMatching 2024-04-30 16:47:21 -07:00
syspolicy all: do not depend on the testing package 2024-05-24 05:23:36 -07:00
sysresources util/sysresources, magicsock: scale DERP buffer based on system memory 2023-04-03 17:14:14 -04:00
systemd all: update copyright and license headers 2023-01-27 15:36:29 -08:00
testenv util/testenv: add new package to hold InTest 2023-08-08 19:51:44 -06:00
topk all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
truncate util/truncate: support []byte as well (#11614) 2024-04-04 14:38:16 -07:00
uniq all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00
vizerror util/vizerror: add As function to get wrapped Error 2023-02-01 14:39:13 -08:00
winutil util/syspolicy: add ReadStringArray interface (#11857) 2024-04-23 22:23:48 -07:00
zstdframe all: use Go 1.22 range-over-int 2024-04-16 15:32:38 -07:00