Skip to content

Instantly share code, notes, and snippets.

@emboss
Created March 18, 2012 05:26
OpenSSL::X509::Certificate vs. Krypt::X509::Certificate
ruby 2.0.0dev (2012-02-11 trunk 34554) [x86_64-linux]
user system total real
OpenSSL::X509::Certificate parse(n=100000) 4.070000 0.160000 4.230000 ( 4.306612)
Krypt::X509::Certificate parse(n=100000) 0.320000 0.010000 0.330000 ( 0.325850)
rubinius 2.0.0dev (1.9.3 3e55abc8 yyyy-mm-dd JI) [x86_64-unknown-linux-gnu]
user system total real
OpenSSL::X509::Certificate parse(n=100000) 4.673289 0.062990 4.736279 ( 4.808672)
Krypt::X509::Certificate parse(n=100000) 0.502923 0.001000 0.503923 ( 0.509898)
jruby 1.7.0.dev (ruby-1.9.3-p6) (2012-01-21 0d0c764) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_02) [linux-amd64-java]
user system total real
OpenSSL::X509::Certificate parse(n=100000) 12.688000 0.000000 12.688000 ( 12.688000)
Krypt::X509::Certificate parse(n=100000) 0.633000 0.000000 0.633000 ( 0.633000)
Comparison with native code:
OpenSSL (using native C) (d2i_X509 100000 times): 2.679s
BouncyCastle (using Java 7u2) (bcprov-jdk15on-147.jar X509StreamParser 100000 times): 3.370648707s
JCE CertificateFactory (using Java 7u2) (CertificateFactory#generateCertificate 100000 times): 0.374258382s
Except for the JCE, even native code is notably slower than Krypt. For once, Ruby is faster than native code :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment