Last active
October 12, 2022 15:01
-
-
Save jsturtevant/0524ab02ac3b6327d85250602a21043f to your computer and use it in GitHub Desktop.
allocations
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
var td TrustDomain | |
func BenchmarkGetTrustDomains(b *testing.B) { | |
m := &Manager{ | |
signingIssuer: &issuer{TrustDomain: "cluster.local"}, | |
validatingIssuer: &issuer{TrustDomain: "cluster.local"}, | |
} | |
var t TrustDomain | |
b.ReportAllocs() | |
for n := 0; n < b.N; n++ { | |
t = m.GetTrustDomains() | |
} | |
td = t | |
} | |
var tdString []string | |
func BenchmarkGetTrustDomainStrings(b *testing.B) { | |
m := &Manager{ | |
signingIssuer: &issuer{TrustDomain: "cluster.local"}, | |
validatingIssuer: &issuer{TrustDomain: "cluster.local"}, | |
} | |
var t []string | |
for n := 0; n < b.N; n++ { | |
t = m.GetTrustDomainsStrings() | |
} | |
tdString = t | |
} |
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
func (m *Manager) GetTrustDomains() TrustDomain { | |
m.mu.Lock() | |
defer m.mu.Unlock() | |
return TrustDomain{Signing: m.signingIssuer.TrustDomain, Validating: m.validatingIssuer.TrustDomain} | |
} | |
func (m *Manager) GetTrustDomainsStrings() []string { | |
m.mu.Lock() | |
defer m.mu.Unlock() | |
if m.signingIssuer.TrustDomain == m.validatingIssuer.TrustDomain { | |
t := make([]string, 1) | |
t[0] = m.signingIssuer.TrustDomain | |
return t | |
} | |
t := make([]string, 2) | |
t[0] = m.signingIssuer.TrustDomain | |
t[1] = m.validatingIssuer.TrustDomain | |
return t | |
} |
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
Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -tags e2e -bench ^BenchmarkGetTrustDomainStrings$ github.com/openservicemesh/osm/pkg/certificate -mod=mod | |
goos: linux | |
goarch: amd64 | |
pkg: github.com/openservicemesh/osm/pkg/certificate | |
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz | |
BenchmarkGetTrustDomainStrings-8 28784193 40.68 ns/op 16 B/op 1 allocs/op | |
PASS | |
ok github.com/openservicemesh/osm/pkg/certificate 1.222s | |
Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -tags e2e -bench ^BenchmarkGetTrustDomains$ github.com/openservicemesh/osm/pkg/certificate -mod=mod | |
goos: linux | |
goarch: amd64 | |
pkg: github.com/openservicemesh/osm/pkg/certificate | |
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz | |
BenchmarkGetTrustDomains-8 59883054 20.03 ns/op 0 B/op 0 allocs/op | |
PASS | |
ok github.com/openservicemesh/osm/pkg/certificate 1.229s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment