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

Conversation

Ice3man543
Copy link
Member

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

…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 Ice3man543 changed the title feat: improve LongestRepeatingSequence performance by reducing allocas feat: improve LongestRepeatingSequence performance by reducing allocs Nov 29, 2024
@ehsandeep ehsandeep merged commit cebafa1 into main Dec 1, 2024
7 checks passed
@ehsandeep ehsandeep deleted the pprof-server-add branch December 1, 2024 13:23
@ehsandeep ehsandeep removed the request for review from dogancanbakir December 1, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants