-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btf: replace postorderIterator with recursion
Throw out the painstakingly hand optimized postorder iterator in favour of a simple recursive function. Turns out this can be a lot faster for larger types, probably because the visited map can be allocated on the stack. There is a small hit to very simple types, but it doesn't seem to affect overall benchmarks too much. core: 1 goos: linux goarch: amd64 pkg: github.com/cilium/ebpf/btf cpu: 12th Gen Intel(R) Core(TM) i7-1260P │ base-po.txt │ recursive.txt │ │ sec/op │ sec/op vs base │ PostorderTraversal/single_type 32.22n ± 0% 39.69n ± 0% +23.18% (p=0.002 n=6) PostorderTraversal/cycle(1) 576.3n ± 3% 112.3n ± 0% -80.51% (p=0.002 n=6) PostorderTraversal/cycle(10) 2.807µ ± 1% 1.578µ ± 1% -43.80% (p=0.002 n=6) PostorderTraversal/gov_update_cpu_data 2.039m ± 1% 1.795m ± 1% -11.97% (p=0.002 n=6) geomean 3.211µ 1.885µ -41.30% │ base-po.txt │ recursive.txt │ │ B/op │ B/op vs base │ PostorderTraversal/single_type 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ PostorderTraversal/cycle(1) 264.0 ± 0% 0.0 ± 0% -100.00% (p=0.002 n=6) PostorderTraversal/cycle(10) 716.5 ± 0% 326.0 ± 0% -54.50% (p=0.002 n=6) PostorderTraversal/gov_update_cpu_data 345.1Ki ± 0% 334.8Ki ± 0% -2.98% (p=0.002 n=6) geomean ² ? ² ³ ¹ all samples are equal ² summaries must be >0 to compute geomean ³ ratios must be >0 to compute geomean │ base-po.txt │ recursive.txt │ │ allocs/op │ allocs/op vs base │ PostorderTraversal/single_type 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=6) ¹ PostorderTraversal/cycle(1) 4.000 ± 0% 0.000 ± 0% -100.00% (p=0.002 n=6) PostorderTraversal/cycle(10) 7.000 ± 0% 1.000 ± 0% -85.71% (p=0.002 n=6) PostorderTraversal/gov_update_cpu_data 132.0 ± 1% 115.0 ± 1% -12.88% (p=0.002 n=6) geomean ² ? ² ³ ¹ all samples are equal ² summaries must be >0 to compute geomean ³ ratios must be >0 to compute geomean Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
- Loading branch information
Showing
6 changed files
with
129 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.