Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve flag parsing performance continuation #4198

Merged
merged 2 commits into from
Aug 23, 2024

Commits on Aug 6, 2024

  1. chore(events): reduce ParseArgs complexity

    This reduces the complexity of the ParseArgs function by extracting
    different parts of it into separate helpers. This makes the code
    easier to read and understand and also makes it smaller.
    
    Before:
    1a080c0      14863 T github.com/aquasecurity/tracee/pkg/events.ParseArgs
    
    After:
    1a0cee0      11632 T github.com/aquasecurity/tracee/pkg/events.ParseArgs
    
    It's a reduction of 21.73% in the size of the function what should also
    improve cache locality and performance.
    
    The benchmark tests also show a significant improvement in performance,
    with a reduction of 6.4% in the time it takes to parse the arguments.
    
    Running tool: /home/gg/.goenv/versions/1.22.4/bin/go test -benchmem
    -run=^$ -tags ebpf -bench ^(BenchmarkParseArgsPrev|BenchmarkParseArgs)$
    github.com/aquasecurity/tracee/pkg/events -benchtime=20000000x -race
    
    goos: linux
    goarch: amd64
    pkg: github.com/aquasecurity/tracee/pkg/events
    cpu: AMD Ryzen 9 7950X 16-Core Processor
    === RUN   BenchmarkParseArgsPrev
    BenchmarkParseArgsPrev
    BenchmarkParseArgsPrev-32               20000000              2002 ns/op               0 B/op          0 allocs/op
    === RUN   BenchmarkParseArgs
    BenchmarkParseArgs
    BenchmarkParseArgs-32                   20000000              1873 ns/op               0 B/op          0 allocs/op
    geyslan committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    115a85c View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2024

  1. chore(events): parseSyscall with no lock

    Bypass the lock contention accessing the read-only map directly.
    geyslan committed Aug 23, 2024
    Configuration menu
    Copy the full SHA
    3adc191 View commit details
    Browse the repository at this point in the history