Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libct/configs/validate: rootlessEUIDMount: speedup
1. Fix function docs. In particular, remove the part which is not true ("verifies that the user isn't trying to set up any mounts they don't have the rights to do"), and fix the part that says "that doesn't resolve to root" (which is no longer true since commit d8b6694). 2. Replace fmt.Sscanf (which is slow and does lots of allocations) with strings.TrimPrefix and strconv.Atoi. 3. Add a benchmark for rootlessEUIDMount. Comparing the old and the new implementations: name old time/op new time/op delta RootlessEUIDMount-4 1.01µs ± 2% 0.16µs ± 1% -84.15% (p=0.008 n=5+5) name old alloc/op new alloc/op delta RootlessEUIDMount-4 224B ± 0% 80B ± 0% -64.29% (p=0.008 n=5+5) name old allocs/op new allocs/op delta RootlessEUIDMount-4 7.00 ± 0% 1.00 ± 0% -85.71% (p=0.008 n=5+5) Note this code is already tested (in rootless_test.go). Fixes: d8b6694 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Loading branch information