Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf:(pipeline) memory efficiency using pool
This commit employs sync.Pool to bolster memory performance in event handling. The benchmarking file, events_pipeline_bench_test.go, simulates the pipeline execution and measures sync.Pool's effectiveness. Benchmark command: go test \ -benchmem -benchtime=10000x -cpu=1 \ -run=^$ -bench ^(BenchmarkEventPool|BenchmarkEventNew)$ \ github.com/aquasecurity/tracee/pkg/ebpf Findings: Execution Time (ns/op): EventPool's execution time compared to EventNew varies slightly between -1.43% to +1.03%. Memory Allocation (B/op): EventPool is significantly memory-efficient, allocating just 26 bytes against EventNew's 448 bytes, yielding around 94.20% memory reduction. Allocation Counts (allocs/op): EventPool reuses memory allocations, achieving 0 allocations per operation, while EventNew makes 1 allocation per operation. In conclusion, sync.Pool results in remarkable memory optimization without substantial impact on runtime. This efficiency is critical in the pipeline that must have high throughput, as it can facilitate garbage collection and promote resource efficiency.
- Loading branch information
Showing
3 changed files
with
282 additions
and
40 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
Oops, something went wrong.