We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The weppos publicsuffix package has a significant impact on the performance of zcrypto/x509 and zmap/zlint, https://github.com/globalsign/publicsuffix might help to improve performance significantly.
zcrypto/x509
zmap/zlint
See the pprof snippet below where the publicsuffix.ParseFromListWithOptions call takes about 35% of the whole runtime.
publicsuffix.ParseFromListWithOptions
See also:
(pprof) list ParseFromListWithOptions Total: 1.78s ROUTINE ======================== github.com/weppos/publicsuffix-go/publicsuffix.ParseFromListWithOptions in /home/digitorus/go/src/github.com/weppos/publicsuffix-go/publicsuffix/publicsuffix.go 0 620ms (flat, cum) 34.83% of Total . . 453: n, err := normalize(name) . . 454: if err != nil { . . 455: return nil, err . . 456: } . . 457: . 460ms 458: r := l.Find(n, options) . 90ms 459: if tld := r.Decompose(n)[1]; tld == "" { . . 460: return nil, fmt.Errorf("%s is a suffix", n) . . 461: } . . 462: . . 463: dn := &DomainName{Rule: r} . 70ms 464: dn.TLD, dn.SLD, dn.TRD = decompose(r, n) . . 465: return dn, nil . . 466:} . . 467: . . 468:func normalize(name string) (string, error) { . . 469: ret := strings.ToLower(name)
Used test for profiling: go test -bench=. -benchmem -cpuprofile profile.out
go test -bench=. -benchmem -cpuprofile profile.out
package main import ( "encoding/pem" "testing" "github.com/zmap/zcrypto/x509" "github.com/zmap/zlint" ) const cert = `-----BEGIN CERTIFICATE----- MIIF+TCCBOGgAwIBAgISAyn7mY0eJNhX/0WOSGr4+2i0MA0GCSqGSIb3DQEBCwUA MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xODA3MTcxNDIwMDlaFw0x ODEwMTUxNDIwMDlaMBIxEDAOBgN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GV0c2VuY3J5cHQub3JnL3JlcG9zaXRvcnkvMIIBBAYKKwYBBAHWeQIE AgSB9QSB8gDwAHYAKTxRllTIOWW6qlD8WAfUt2+/WHopctykwwz05UVH9HgAAAFk qNPIygAABAMARzBFAiEAiBDl2llqZ+NAx+qKDR4Nz7skZFyXBCIIleZvqTEfOtYC IAPJQoWeSH9dTrIamnoWMz0GcU5pmFiThRvV7lYzBjxFAHYAVYHUwhaQNgFK6gub VzxT8MDkOHhwJQgXL6OqHQcT0wwAAAFkqNPKdQAABAMARzBFAiEA9cuUQMkCFTQc T/c+xJSufZy4sCLBwVAkeaSqn/gRVX4CIFaMT0Y/HDP92CbcnioU42ycKC2Rp4av IYylOSyBvA4sMA0GCSqGSIb3DQEBCwUAA4IBAQCDx1Tjl+IErHLZh3GqTINsbKg5 9UuwChKxoZIfaONl+Ot7pZwiMJeUrrE/1IJyPvItfpmCzKrucJEt5Y0iqWiC/kYt GGA1qt1JyqYCXuQ5EAP7PRW4OrtfRXPZ8A4TEttU5NPw0bEbHde030soHiwvFSvn NxN5jkMRHMVT6h5B9JcF9HAM0RRCfd8GKigbqrJkC6DJwQ+4VBU/e6JwQSti0S4T YR/hQaPp410CUKxYrN68bI2HApw2qahzmIVCeo3gwBpickZsf+J+z9+VFlSHivVu tuzpSShRCSSym392PUfxgkvfxy97+2pveJ45uAv7z/pfWIwYVUfgHktN92Bz -----END CERTIFICATE-----` func BenchmarkHandler(b *testing.B) { block, _ := pem.Decode([]byte(cert)) for n := 0; n < b.N; n++ { parsed, err := x509.ParseCertificate(block.Bytes) if err != nil { b.Fatal(err) } zlint.LintCertificate(parsed) } }
cc: @szank, @zakird
The text was updated successfully, but these errors were encountered:
PR weppos/publicsuffix-go#143 has drastically improved the performance of this dependency, please consider this as closed.
Sorry, something went wrong.
No branches or pull requests
The weppos publicsuffix package has a significant impact on the performance of
zcrypto/x509
andzmap/zlint
, https://github.com/globalsign/publicsuffix might help to improve performance significantly.See the pprof snippet below where the
publicsuffix.ParseFromListWithOptions
call takes about 35% of the whole runtime.See also:
Used test for profiling:
go test -bench=. -benchmem -cpuprofile profile.out
cc: @szank, @zakird
The text was updated successfully, but these errors were encountered: