Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/e2e/framework/log: optimize PrunedStack()
Use bytes instead of strings, and slice in-place filter (see https://github.com/golang/go/wiki/SliceTricks#filter-in-place) to avoid copying strings around. In my benchmark it shows almost 2x improvement: BenchmarkString-8 1477207 10198 ns/op BenchmarkBuffer-8 1561291 7622 ns/op BenchmarkInPlace-8 2295714 5202 ns/op String is the original implementation, Buffer is an intermediary one that uses strings.Builder, and InPlace is the one from this commit. Signed-off-by: Kir Kolyshkin <[email protected]>
- Loading branch information