8000 implement html extration feature by fatihbaltaci · Pull Request #247 · getanteon/anteon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

implement html extration feature #247

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
merged 11 commits into from
Nov 24, 2023
Merged

implement html extration feature #247

merged 11 commits into from
Nov 24, 2023

Conversation

fatihbaltaci
Copy link
Member

No description provided.

bastoscorp and others added 11 commits June 15, 2023 15:52
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>
Avoid allocations with `(*regexp.Regexp).MatchString`
Copy link
codecov bot commented Nov 22, 2023

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (bcd58f3) 81.77% compared to head (30023a2) 81.62%.
Report is 34 commits behind head on master.

Files Patch % Lines
core/scenario/scripting/extraction/html.go 59.09% 6 Missing and 3 partials ⚠️
core/scenario/scripting/extraction/base.go 45.45% 5 Missing and 1 partial ⚠️
core/types/scenario.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
- Coverage   81.77%   81.62%   -0.15%     
==========================================
  Files          37       38       +1     
  Lines        5195     5241      +46     
==========================================
+ Hits         4248     4278      +30     
- Misses        766      778      +12     
- Partials      181      185       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fatihbaltaci fatihbaltaci merged commit ae9bcd5 into master Nov 24, 2023
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
0