-
Notifications
You must be signed in to change notification settings - Fork 384
Avoid allocatio
8000
ns with (*regexp.Regexp).MatchString
#245
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
Merged
Conversation
This file contains hidden or 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
accept dash on vars
req body store limit
Performance Improvement on Multipart
Self Hosted
Response Duration & Cookies & Fixes & Remote URL Payload
fix invalid capacity bug for distinct user mode
Add helm chart k8s install info to readme
Update docker compose for self hosted
Update self hosted install script
Update self hosted install script
Check status code for remote file on multipart
Update self hosted app versions
Update Ddosify Self Hosted - Hammer 1.4.0
add p98 func
Update goreleaser
Fix install script
override req host from header
Update self hosted install command
AWS marketplace badge
Monitoring - Self Hosted
Update prometheus scrape interval
Update Ddosify Self Hosted
Update Ddosify Self Hosted
Update readme
Update ddosify self hosted
Update self hosted frontend
Update icon selection dark / light
Update readme
Update self hosted frontend and backend
Update self hosted frontend and backend
Update self hosted backend
We should use `(*regexp.Regexp).MatchString` instead of `(*regexp.Regexp).Match([]byte(...))` when matching string to avoid unnecessary `[]byte` conversions and reduce allocations. Example benchmark: func BenchmarkMatch(b *testing.B) { for i := 0; i < b.N; i++ { if match := envVarNameRegexp.Match([]byte("FOO_BAR")); !match { b.Fail() } } } func BenchmarkMatchString(b *testing.B) { for i := 0; i < b.N; i++ { if match := envVarNameRegexp.MatchString("FOO_BAR"); !match { b.Fail() } } } goos: linux goarch: amd64 pkg: go.ddosify.com/ddosify/core/types cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics BenchmarkMatch-16 4542174 277.2 ns/op 8 B/op 1 allocs/op BenchmarkMatchString-16 7210927 172.1 ns/op 0 B/op 0 allocs/op PASS ok go.ddosify.com/ddosify/core/types 3.908s Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Max. Delta Time op: 2.71 / 15 |
Hey @Juneezee, thanks for your contribution |
Max. Delta Time op: 3.07 / 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Type of Change
Description
We should use
(*regexp.Regexp).MatchString
instead of(*regexp.Regexp).Match([]byte(...))
when matching string to avoid unnecessary[]byte
conversions and reduce allocations. A one-line change for free performance improvement.Example benchmark:
Result:
Related Issue(s)
Checklist
Screenshots