Skip to content

crypto/tls: tls.X509KeyPair is slow #6626

Description

@rogpeppe
I was investigating why some code was taking a noticeable (260ms)
time to run, and found that it was because it was calling tls.X509KeyPair
a few times.

The time taken by tls.X509KeyPair is dominated by the time
taken by rsa.PrivateKey.Validate, which is itself dominated
by the probabilistic prime test, which takes ~30ms. Since the
test is not that great (cf. the comment in the function), perhaps
we could lose it.

The time taken by the code in my test case dropped
to 50ms with that test removed, with X509KeyPair no longer
being the dominant factor.

go version go1.2rc2 linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions