Open dsaenztagarro opened 7 years ago
A simple program like:
# example.rb require 'octokit' puts 'hello world'
When executed with ruby -rprofile example.rb brings the following results:
ruby -rprofile example.rb
Compare with usual hello world script (removing require "octokit"):
require "octokit"
octokit
texto
This is a test
This is other test
This is a test. More text. And more
Context
A simple program like:
When executed with
ruby -rprofile example.rb
brings the following results:See stdout
``` $ ruby -rprofile example.rb hello world % cumulative self self total time seconds seconds calls ms/call ms/call name 20.89 0.33 0.33 391 0.84 50.38 Kernel#require 12.03 0.52 0.19 4 47.50 82.50 Hash#each 6.96 0.63 0.11 1476 0.07 0.09 Gem::Version#<=> 6.33 0.73 0.10 6248 0.02 0.25 nil# 4.43 0.80 0.07 1781 0.04 1.44 Array#each 3.16 0.85 0.05 2519 0.02 0.08 Gem::BasicSpecification#have_file? 3.16 0.90 0.05 1926 0.03 0.11 Array#any? 2.53 0.94 0.04 3091 0.01 0.01 Module#method_added 2.53 0.98 0.04 2221 0.02 0.16 Gem::Requirement#satisfied_by? 1.90 1.01 0.03 11246 0.00 0.00 Module#=== 1.90 1.04 0.03 802 0.04 0.55 Gem::Dependency#matching_specs 1.90 1.07 0.03 4898 0.01 0.03 Gem::StubSpecification#data 1.27 1.09 0.02 5545 0.00 0.00 Integer#== 1.27 1.11 0.02 3031 0.01 0.01 Gem::Version#_segments 1.27 1.13 0.02 918 0.02 0.02 Array#hash 1.27 1.15 0.02 201 0.10 0.10 MonitorMixin#mon_enter 1.27 1.17 0.02 2346 0.01 0.02 Gem::StubSpecification#activated? 1.27 1.19 0.02 63 0.32 0.63 Gem::StubSpecification::StubLine#initialize 1.27 1.21 0.02 1531 0.01 0.01 File.file? 1.27 1.23 0.02 968 0.02 0.61 Gem::Specification#traverse 0.63 1.24 0.01 248 0.04 0.24 Gem::Specification#initialize 0.63 1.25 0.01 488 0.02 0.02 Gem::BasicSpecification#have_extensions? 0.63 1.26 0.01 654 0.02 0.02 Gem::StubSpecification#version 0.63 1.27 0.01 498 0.02 0.28 Gem::BasicSpecification#contains_requirable_file? 0.63 1.28 0.01 160 0.06 0.06 Gem::Specification#hash 0.63 1.29 0.01 201 0.05 0.05 MonitorMixin#mon_exit 0.63 1.30 0.01 1 10.00 10.00 Marshal.load 0.63 1.31 0.01 4233 0.00 0.00 Array#length 0.63 1.32 0.01 8 1.25 1.25 Struct.new 0.63 1.33 0.01 83 0.12 0.12 Module#include 0.63 1.34 0.01 121 0.08 0.08 String#=~ 0.63 1.35 0.01 118 0.08 0.17 Gem::Version.correct? 0.63 1.36 0.01 1 10.00 10.00 OpenSSL::X509::Store#set_default_paths 0.63 1.37 0.01 28 0.36 0.36 Forwardable._valid_method? 0.63 1.38 0.01 2303 0.00 0.01 Hash#[]= 0.63 1.39 0.01 883 0.01 0.20 Enumerable#all? 0.63 1.40 0.01 1 10.00 250.00 Faraday::RackBuilder#use_symbol 0.63 1.41 0.01 1 10.00 30.00 Array#sort! 0.63 1.42 0.01 306 0.03 0.03 IO#set_encoding 0.63 1.43 0.01 563 0.02 0.02 Gem::StubSpecification#extensions 0.63 1.44 0.01 292 0.03 0.03 Gem::StubSpecification#raw_require_paths 0.63 1.45 0.01 22 0.45 0.91 Gem::Requirement#as_list 0.63 1.46 0.01 8 1.25 1.25 Gem::Specification#date= 0.63 1.47 0.01 1280 0.01 0.01 Integer#chr 0.63 1.48 0.01 1280 0.01 0.01 String#% 0.63 1.49 0.01 284 0.04 2.64 Gem::Specification.find_in_unresolved_tree 0.63 1.50 0.01 12701 0.00 0.00 Array#[] 0.63 1.51 0.01 595 0.02 0.02 Gem::Specification#dependencies 0.63 1.52 0.01 592 0.02 0.03 Gem::Platform.match 0.63 1.53 0.01 2902 0.00 0.01 Gem::StubSpecification#name 0.63 1.54 0.01 335 0.03 1.10 Class#new 0.63 1.55 0.01 333 0.03 0.15 Gem::Specification._resort! 0.63 1.56 0.01 247 0.04 0.04 Kernel#dup 0.63 1.57 0.01 2401 0.00 0.11 Gem::Specification.find_active_stub_by_path 0.63 1.58 0.01 380 0.03 0.05 Octokit::Default.options 0.00 1.58 0.00 72 0.00 0.00 String#gsub 0.00 1.58 0.00 56 0.00 0.18 Gem::Version#initialize 0.00 1.58 0.00 40 0.00 0.25 Array#map! 0.00 1.58 0.00 1 0.00 50.00 Enumerable#flat_map 0.00 1.58 0.00 1 0.00 0.00 Array#concat 0.00 1.58 0.00 363 0.00 0.00 Gem::StubSpecification#full_name 0.00 1.58 0.00 110 0.00 0.82 Gem::Specification.stubs 0.00 1.58 0.00 4 0.00 0.00 Array#uniq 0.00 1.58 0.00 1 0.00 0.00 Gem::Specification.uniq_by 0.00 1.58 0.00 332 0.00 0.00 String#<=> 0.00 1.58 0.00 332 0.00 0.00 Numeric#zero? 0.00 1.58 0.00 332 0.00 0.00 Numeric#nonzero? 0.00 1.58 0.00 1476 0.00 0.00 Gem::Version#_version 0.00 1.58 0.00 30 0.00 0.00 String#scan 0.00 1.58 0.00 103 0.00 0.00 String#to_i 0.00 1.58 0.00 67 0.00 0.00 Kernel#freeze 0.00 1.58 0.00 1460 0.00 0.00 Integer#<=> 0.00 1.58 0.00 1 0.00 0.00 Enumerable#group_by 0.00 1.58 0.00 292 0.00 0.00 Gem::StubSpecification#default_gem? 0.00 1.58 0.00 292 0.00 0.03 Gem::StubSpecification#missing_extensions? 0.00 1.58 0.00 91 0.00 1.98 Gem::Specification.find_by_path 0.00 1.58 0.00 9 0.00 0.00 Gem.default_ext_dir_for 0.00 1.58 0.00 9 0.00 0.00 Gem::Platform.local 0.00 1.58 0.00 9 0.00 0.00 Gem::Platform#to_a 0.00 1.58 0.00 11 0.00 0.00 Array#compact 0.00 1.58 0.00 26 0.00 0.00 Array#join 0.00 1.58 0.00 9 0.00 0.00 Gem::Platform#to_s 0.00 1.58 0.00 9 0.00 0.00 Gem.ruby_api_version 0.00 1.58 0.00 9 0.00 0.00 Gem.extension_api_version 0.00 1.58 0.00 9 0.00 0.00 Gem::BasicSpecification#extensions_dir 0.00 1.58 0.00 37 0.00 0.00 File.expand_path 0.00 1.58 0.00 22 0.00 0.00 Gem::BasicSpecification#extension_dir 0.00 1.58 0.00 7 0.00 0.00 Gem::BasicSpecification#gem_build_complete_path 0.00 1.58 0.00 7 0.00 0.00 File.exist? 0.00 1.58 0.00 58 0.00 3.10 Enumerable#find 0.00 1.58 0.00 93 0.00 0.00 Hash#values 0.00 1.58 0.00 324 0.00 0.12 Gem::StubSpecification#to_spec 0.00 1.58 0.00 8 0.00 0.00 IO.read 0.00 1.58 0.00 8 0.00 0.00 Kernel#binding 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#internal_init 0.00 1.58 0.00 465 0.00 0.00 Symbol#to_s 0.00 1.58 0.00 259 0.00 0.00 Kernel#instance_variable_set 0.00 1.58 0.00 160 0.00 0.00 Gem::Specification#default_value 0.00 1.58 0.00 99 0.00 0.00 Array#initialize_copy 0.00 1.58 0.00 8 0.00 0.00 Hash#initialize_copy 0.00 1.58 0.00 16 0.00 0.00 Kernel#initialize_copy 0.00 1.58 0.00 10 0.00 0.00 Kernel#block_given? 0.00 1.58 0.00 614 0.00 0.00 Kernel#nil? 0.00 1.58 0.00 8 0.00 0.00 Gem::Version.create 0.00 1.58 0.00 47 0.00 0.00 Kernel#instance_variable_defined? 0.00 1.58 0.00 14 0.00 0.00 Gem::Version#prerelease? 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#invalidate_memoized_attributes 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#version= 0.00 1.58 0.00 150 0.00 0.00 Array#flatten 0.00 1.58 0.00 42 0.00 0.00 Array#compact! 0.00 1.58 0.00 42 0.00 0.00 Array#uniq! 0.00 1.58 0.00 45 0.00 0.22 Gem::Requirement.parse 0.00 1.58 0.00 87 0.00 0.23 Gem::Requirement#initialize 0.00 1.58 0.00 41 0.00 0.24 Gem::Requirement.create 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#required_rubygems_version= 0.00 1.58 0.00 36 0.00 0.00 Kernel#Array 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#require_paths= 0.00 1.58 0.00 8 0.00 0.00 Enumerable#grep 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#authors= 0.00 1.58 0.00 63 0.00 0.00 Integer#+ 0.00 1.58 0.00 8 0.00 0.00 Time.utc 0.00 1.58 0.00 6 0.00 0.00 Gem::Specification#description= 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#licenses= 0.00 1.58 0.00 6 0.00 0.00 Gem::Specification#required_ruby_version= 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#summary= 0.00 1.58 0.00 8 0.00 0.00 Gem::Specification#installed_by_version= 0.00 1.58 0.00 1011 0.00 0.10 Comparable#>= 0.00 1.58 0.00 340 0.00 0.00 Array#pop 0.00 1.58 0.00 24 0.00 0.00 Array#first 0.00 1.58 0.00 27 0.00 0.00 Array#include? 0.00 1.58 0.00 20 0.00 0.50 Gem::Dependency#initialize 0.00 1.58 0.00 15 0.00 0.67 Gem::Specification#add_dependency_with_type 0.00 1.58 0.00 9 0.00 0.00 Gem::Specification#add_development_dependency 0.00 1.58 0.00 6 0.00 1.67 Gem::Specification#add_runtime_dependency 0.00 1.58 0.00 17 0.00 3.53 Gem::Specification.load 0.00 1.58 0.00 8 0.00 5.00 Kernel#eval 0.00 1.58 0.00 7 0.00 0.00 String#upcase 0.00 1.58 0.00 389 0.00 0.00 #Compare with usual hello world script (removing
require "octokit"
):See stdout
``` $ ruby -rprofile bin/test.rb hello world % cumulative self self total time seconds seconds calls ms/call ms/call name 0.00 0.00 0.00 1 0.00 0.00 TracePoint#enable 0.00 0.00 0.00 2 0.00 0.00 IO#set_encoding 0.00 0.00 0.00 2 0.00 0.00 IO#write 0.00 0.00 0.00 1 0.00 0.00 IO#puts 0.00 0.00 0.00 1 0.00 0.00 Kernel#puts 0.00 0.00 0.00 1 0.00 0.00 TracePoint#disable 0.00 0.01 0.00 1 0.00 10.00 #toplevel ```Requirement
octokit
dependency to boost gundam scripts.