Skip to content

Instantly share code, notes, and snippets.

@vosst
Created April 4, 2017 06:54
Show Gist options
  • Save vosst/cb3d16e1f1596baf6ccb989d6b1897a7 to your computer and use it in GitHub Desktop.
Save vosst/cb3d16e1f1596baf6ccb989d6b1897a7 to your computer and use it in GitHub Desktop.
Profiling Go's RSA key generation
package main
import (
"crypto/rand"
"crypto/rsa"
"os"
"runtime/pprof"
)
func main() {
f, err := os.Create("rsa_cpu_profile")
if err != nil {
panic(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
_, err = rsa.GenerateKey(rand.Reader, 4096)
if err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment