helper/bwrap: allocate large args slice
All checks were successful
Tests / Go tests (push) Successful in 35s
Nix / NixOS tests (push) Successful in 4m0s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-01-03 13:10:57 +09:00
parent 6acd0d4e88
commit 55d83eb9b0
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -54,6 +54,11 @@ func (c *Config) Args() (args []string) {
c.pairArgs(),
}
/* this is only 8 KiB of memory on a 64-bit system,
permissive defaults on NixOS results in around 200 args
so this capacity should eliminate copies for most setups */
args = make([]string, 0, 512)
// copy FSBuilder slice to builder slice
fb := make([]Builder, len(c.Filesystem)+1)
for i, f := range c.Filesystem {