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

Avoid making a subscope in tallyMetricsHandler if possible #4363

Merged
merged 1 commit into from
May 23, 2023

Conversation

k24dizzle
Copy link
Contributor

Creating a subscope, even if it is tmp.Scope.Tagged(nil), takes extra time.

Used this script to benchmark.

Before:

go test -benchmem -run=^$ -bench . -benchtime=10s
goos: darwin
goarch: arm64
pkg: test/prom13
BenchmarkCounter-10     67209068               170.4 ns/op            48 B/op          2 allocs/op
PASS
ok      test/prom13     11.812s

After:

go test -benchmem -run=^$ -bench . -benchtime=10s
goos: darwin
goarch: arm64
pkg: test/prom13
BenchmarkCounter-10     84332931               138.2 ns/op            48 B/op          2 allocs/op
PASS
ok      test/prom13     12.028s

@k24dizzle k24dizzle requested a review from a team as a code owner May 18, 2023 18:31
@k24dizzle k24dizzle merged commit b191203 into master May 23, 2023
@k24dizzle k24dizzle deleted the kevin/avoidsubscope branch May 23, 2023 18:44
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.

2 participants