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

feat: improve LongestRepeatingSequence performance by reducing allocs #575

Merged
merged 1 commit into from
Dec 1, 2024

Commits on Nov 29, 2024

  1. feat: improve LongestRepeatingSequence performance by reducing alloca…

    …tions
    
    Uses an optimization to keep only two arrays + other misc changes.
    
    Benchmarks:
    
    $ go test -bench=. -benchmem -memprofile=allocs
    goos: darwin
    goarch: amd64
    pkg: github.com/projectdiscovery/utils/strings
    cpu: VirtualApple @ 2.50GHz
    BenchmarkLongestRepeatingSequence-10              171566              6612 ns/op           15584 B/op         61 allocs/op
    BenchmarkLongestRepeatingSequenceNew-10              360710              3129 ns/op             704 B/op          2 allocs/op +++
    PASS
    ok      github.com/projectdiscovery/utils/strings       1.851s
    Ice3man543 committed Nov 29, 2024
    Configuration menu
    Copy the full SHA
    2f4ef52 View commit details
    Browse the repository at this point in the history