Skip to content

Instantly share code, notes, and snippets.

@thomas07vt
Last active October 19, 2016 18:53
Show Gist options
  • Save thomas07vt/75804301529fa4b0b3b1383c325a6c3a to your computer and use it in GitHub Desktop.
Save thomas07vt/75804301529fa4b0b3b1383c325a6c3a to your computer and use it in GitHub Desktop.
$ ruby -v
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.102-b14 on 1.8.0_102-b14 +jit [linux-x86_64]
$ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
$ gem list
...
jruby-openssl (0.9.17 java, 0.9.15 java)
...
$ irb
jruby-9.1.2.0 :011 > OpenSSL::X509::DEFAULT_CERT_FILE
=> "/etc/pki/tls/certs/ca-bundle.crt"
# bench1.rb
##########################################################################################################################
require 'jruby/profiler'
require 'jruby-openssl'
profile_data = JRuby::Profiler.profile do
10.times { OpenSSL::X509::Store.new.set_default_paths }
end
profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data)
profile_printer.printProfile(STDOUT)
$ jruby --profile.api bench1.rb
Profiling enabled; ^C shutdown will now dump profile info
Total time: 3.03
total self children calls method
----------------------------------------------------------------
3.03 0.00 3.02 1 Fixnum#times
3.02 3.02 0.00 10 OpenSSL::X509::Store#set_default_paths
0.00 0.00 0.00 10 Class#new
0.00 0.00 0.00 10 OpenSSL::X509::Store#initialize
# bench2.rb
##########################################################################################################################
require 'jruby/profiler'
require 'jruby-openssl'
ENV['SSL_CERT_FILE'] = '/usr/java/jdk1.8.0_102/jre/lib/security/cacerts'
profile_data = JRuby::Profiler.profile do
10.times { OpenSSL::X509::Store.new.set_default_paths }
end
profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data)
profile_printer.printProfile(STDOUT)
$ jruby --profile.api bench2.rb
Profiling enabled; ^C shutdown will now dump profile info
Total time: 0.19
total self children calls method
----------------------------------------------------------------
0.19 0.00 0.19 1 Fixnum#times
0.19 0.19 0.00 10 OpenSSL::X509::Store#set_default_paths
0.00 0.00 0.00 10 Class#new
0.00 0.00 0.00 10 OpenSSL::X509::Store#initialize
# bench3.rb
##########################################################################################################################
require 'jruby/profiler'
require 'jruby-openssl'
ENV['SSL_CERT_FILE'] = '/etc/pki/tls/certs/ca-bundle.crt'
profile_data = JRuby::Profiler.profile do
10.times { OpenSSL::X509::Store.new.set_default_paths }
end
profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data)
profile_printer.printProfile(STDOUT)
$ jruby --profile.api bench3.rb
Profiling enabled; ^C shutdown will now dump profile info
Total time: 3.15
total self children calls method
----------------------------------------------------------------
3.15 0.00 3.15 1 Fixnum#times
3.15 3.15 0.00 10 OpenSSL::X509::Store#set_default_paths
0.00 0.00 0.00 10 Class#new
0.00 0.00 0.00 10 OpenSSL::X509::Store#initialize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment