Skip to content

Conversation

@k0kubun
Copy link
Member

@k0kubun k0kubun commented Dec 21, 2022

This PR adds a harness to do the same thing as #123, collecting C method statistics, whenever we want.

Example

activerecord

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/activerecord/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
-- create_table(:posts, {:force=>true})
   -> 0.0016s
itr #1: 1926ms
Top 10 block calls by C methods (100.0% of all 52000 calls):
   22000 (42.3%) Array#each
   10000 (19.2%) Hash#each_key
    6000 (11.5%) Array#map
    4000 ( 7.7%) #<Class:Thread>#handle_interrupt
    2000 ( 3.8%) Kernel#loop
    2000 ( 3.8%) Hash#each
    2000 ( 3.8%) Array#map!
    2000 ( 3.8%) Monitor#synchronize
    1000 ( 1.9%) Integer#times
    1000 ( 1.9%) Hash#select

Top 100 C method calls (93.0% of all 856021 calls):
   87000 (10.2%) Hash#[]
   44000 ( 5.1%) Module#===
   35000 ( 4.1%) Hash#fetch
   25000 ( 2.9%) #<Class:Thread>#current
   25000 ( 2.9%) Class#new
   25000 ( 2.9%) BasicObject#!
   22000 ( 2.6%) Arel::Collectors::Composite#right
   22000 ( 2.6%) Arel::Collectors::Composite#left
   21000 ( 2.5%) String#<<
   21000 ( 2.5%) Kernel#hash
   20000 ( 2.3%) Hash#[]=
   19000 ( 2.2%) Array#empty?
   18001 ( 2.1%) Array#[]
   18000 ( 2.1%) Kernel#is_a?
   17000 ( 2.0%) ActiveRecord::Relation#klass
   17000 ( 2.0%) Array#each
   15003 ( 1.8%) Integer#+
   14000 ( 1.6%) Thread#[]
   12000 ( 1.4%) Arel::Visitors::Visitor#dispatch
   12000 ( 1.4%) Hash#delete
   10000 ( 1.2%) Integer#<
   10000 ( 1.2%) Array#include?
    9000 ( 1.1%) Module#name
    9000 ( 1.1%) Array#any?
    9000 ( 1.1%) BasicObject#initialize
    9000 ( 1.1%) String#-@
    8000 ( 0.9%) String#to_s
    8000 ( 0.9%) Kernel#respond_to?
    7000 ( 0.8%) Class#superclass
    7000 ( 0.8%) ActiveRecord::TableMetadata#klass
    7000 ( 0.8%) Kernel#nil?
    6000 ( 0.7%) Kernel#block_given?
    6000 ( 0.7%) ActiveRecord::PredicateBuilder#table
    6000 ( 0.7%) ActiveModel::Attribute#value_before_type_cast
    6000 ( 0.7%) Array#map
    6000 ( 0.7%) Kernel#dup
    6000 ( 0.7%) Kernel#initialize_dup
    5000 ( 0.6%) Kernel#object_id
    5000 ( 0.6%) Module#==
    5000 ( 0.6%) Hash#initialize_copy
    5000 ( 0.6%) ActiveRecord::Relation::WhereClause#predicates
    5000 ( 0.6%) Arel::Nodes::BindParam#value
    4000 ( 0.5%) Arel::Table#table_alias
    4000 ( 0.5%) Kernel#freeze
    4000 ( 0.5%) #<Class:Process>#pid
    4000 ( 0.5%) Thread#thread_variable_get
    4000 ( 0.5%) Enumerable#each_with_index
    4000 ( 0.5%) Array#map!
    4000 ( 0.5%) Arel::Table#name
    4000 ( 0.5%) ActiveModel::Attribute#type
    4000 ( 0.5%) Arel::Nodes::SelectCore#source
    4000 ( 0.5%) Integer#==
    4000 ( 0.5%) Arel::Nodes::Binary#left
    3001 ( 0.4%) Array#<<
    3000 ( 0.4%) Array#flatten!
    3000 ( 0.4%) Array#+
    3000 ( 0.4%) FalseClass#===
    3000 ( 0.4%) ActiveRecord::Relation#table
    3000 ( 0.4%) TrueClass#===
    3000 ( 0.4%) Array#length
    3000 ( 0.4%) Kernel#initialize_clone
    3000 ( 0.4%) Symbol#to_s
    3000 ( 0.4%) Struct#initialize
    3000 ( 0.4%) #<Class:#<Class:0x0000000106891b00>>#new
    3000 ( 0.4%) BasicObject#==
    3000 ( 0.4%) BasicObject#!=
    3000 ( 0.4%) Arel::Nodes::SelectStatement#orders
    3000 ( 0.4%) Hash#each_key
    2001 ( 0.2%) Integer#>
    2000 ( 0.2%) Arel::Nodes::SelectCore#projections
    2000 ( 0.2%) NilClass#nil?
    2000 ( 0.2%) ActiveRecord::ConnectionAdapters::AbstractAdapter#visitor
    2000 ( 0.2%) Arel::Nodes::SelectStatement#offset
    2000 ( 0.2%) Hash#each
    2000 ( 0.2%) Enumerable#map
    2000 ( 0.2%) Arel::Nodes::Binary#right
    2000 ( 0.2%) Integer#<=>
    2000 ( 0.2%) Arel::Nodes::Unary#expr
    2000 ( 0.2%) Array#first
    2000 ( 0.2%) NilClass#===
    2000 ( 0.2%) Hash#empty?
    2000 ( 0.2%) SQLite3::Statement#bind_param
    2000 ( 0.2%) SQLite3::Database#encoding
    2000 ( 0.2%) SQLite3::Statement#done?
    2000 ( 0.2%) Module#<=
    2000 ( 0.2%) Kernel#instance_variable_defined?
    2000 ( 0.2%) SQLite3::Statement#step
    2000 ( 0.2%) Enumerable#flat_map
    2000 ( 0.2%) ActiveRecord::TableMetadata#types
    2000 ( 0.2%) Array#last
    2000 ( 0.2%) ActiveRecord::Relation#loaded
    2000 ( 0.2%) Array#reject!
    2000 ( 0.2%) Arel::Nodes::SelectStatement#cores
    2000 ( 0.2%) String#include?
    2000 ( 0.2%) Arel::Nodes::SelectCore#wheres
    2000 ( 0.2%) Array#concat
    2000 ( 0.2%) String#initialize
    2000 ( 0.2%) #<Class:Thread>#handle_interrupt
    2000 ( 0.2%) Monitor#synchronize
    2000 ( 0.2%) Symbol#==

hexapdf

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/hexapdf/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
itr #1: 72665ms
Top 29 block calls by C methods (100.0% of all 3536312 calls):
 1343368 (38.0%) Array#each
 1062997 (30.1%) Array#sum
  697504 (19.7%) Array#map!
  209898 ( 5.9%) Array#bsearch_index
   81798 ( 2.3%) Hash#each
   39090 ( 1.1%) Array#each_index
   29288 ( 0.8%) Array#select
   17092 ( 0.5%) Array#sort!
   11480 ( 0.3%) Integer#downto
    9818 ( 0.3%) Hash#each_key
    9029 ( 0.3%) Array#map
    6539 ( 0.2%) Hash#each_value
    5726 ( 0.2%) Array#any?
    3281 ( 0.1%) Fiber#resume
    2388 ( 0.1%) Integer#times
    1628 ( 0.0%) Array#reject!
    1627 ( 0.0%) Array#select!
    1626 ( 0.0%) Array#rindex
     840 ( 0.0%) Hash#[]
     820 ( 0.0%) Array#delete_if
     224 ( 0.0%) Range#each
     223 ( 0.0%) Integer#upto
      14 ( 0.0%) Module#module_eval
       5 ( 0.0%) Hash#delete
       4 ( 0.0%) #<Class:IO>#open
       2 ( 0.0%) Hash#transform_values
       1 ( 0.0%) #<Class:Struct>#new
       1 ( 0.0%) Enumerable#reverse_each
       1 ( 0.0%) Module#refine

Top 100 C method calls (97.9% of all 45380587 calls):
 3239193 ( 7.1%) Hash#[]
 2491687 ( 5.5%) HexaPDF::Layout::TextFragment#style
 2377855 ( 5.2%) Kernel#kind_of?
 2254003 ( 5.0%) Integer#+
 1703849 ( 3.8%) Array#[]
 1514209 ( 3.3%) HexaPDF::Layout::TextFragment#items
 1421062 ( 3.1%) Kernel#hash
 1156732 ( 2.5%) Float#+
 1149130 ( 2.5%) Integer#-
 1127352 ( 2.5%) BasicObject#!
 1115692 ( 2.5%) Array#<<
 1091811 ( 2.4%) Geom2D::Point#x
  964984 ( 2.1%) Symbol#==
  932422 ( 2.1%) HexaPDF::Font::Type1Wrapper::Glyph#str
  822355 ( 1.8%) String#<<
  811969 ( 1.8%) Geom2D::Algorithms::PolygonOperation::SweepEvent#point
  799739 ( 1.8%) Geom2D::Point#y
  768030 ( 1.7%) Float#-
  697434 ( 1.5%) Regexp#match?
  677772 ( 1.5%) Integer#*
  661586 ( 1.5%) Array#size
  659622 ( 1.5%) HexaPDF::Content::Canvas#graphics_object
  626447 ( 1.4%) HexaPDF::Font::Type1Wrapper::Glyph#name
  616064 ( 1.4%) Integer#==
  615052 ( 1.4%) BasicObject#==
  601079 ( 1.3%) Class#new
  536154 ( 1.2%) #<Class:Geom2D::Utils>#precision
  525446 ( 1.2%) Float#<=
  514064 ( 1.1%) Integer#<
  481495 ( 1.1%) BasicObject#!=
  478456 ( 1.1%) Array#empty?
  450788 ( 1.0%) HexaPDF::Content::Canvas#graphics_state
  433155 ( 1.0%) Array#each
  426810 ( 0.9%) Float#<
  361961 ( 0.8%) Array#clear
  356881 ( 0.8%) HexaPDF::Object#data
  336821 ( 0.7%) HexaPDF::Layout::TextLayouter::Box#item
  303578 ( 0.7%) Kernel#instance_of?
  287243 ( 0.6%) HexaPDF::PDFData#value
  268250 ( 0.6%) Array#sum
  252165 ( 0.6%) Array#last
  248834 ( 0.5%) Kernel#initialize_dup
  248834 ( 0.5%) Kernel#dup
  243620 ( 0.5%) Float#>
  236755 ( 0.5%) Geom2D::Algorithms::PolygonOperation::SweepEvent#other_event
  234718 ( 0.5%) HexaPDF::Layout::TextLayouter#style
  224138 ( 0.5%) Kernel#nil?
  220463 ( 0.5%) Geom2D::Segment#start_point
  217254 ( 0.5%) HexaPDF::Layout::Line#x_offset=
  217254 ( 0.5%) HexaPDF::Content::GraphicsState#tlm
  217254 ( 0.5%) HexaPDF::Layout::Line#x_offset
  217167 ( 0.5%) Array#concat
  204662 ( 0.5%) Integer#/
  195741 ( 0.4%) Integer#>
  195261 ( 0.4%) Geom2D::Algorithms::PolygonOperation::SweepEvent#left
  190881 ( 0.4%) Array#[]=
  187015 ( 0.4%) Array#push
  165143 ( 0.4%) Geom2D::Segment#end_point
  163640 ( 0.4%) Float#*
  160732 ( 0.4%) Integer#<=>
  146464 ( 0.3%) HexaPDF::Layout::Line#y_offset
  144836 ( 0.3%) HexaPDF::Content::GraphicsState#leading
  144835 ( 0.3%) HexaPDF::Layout::Style::LineSpacing#value
  144835 ( 0.3%) HexaPDF::Layout::Style::LineSpacing#type
  140717 ( 0.3%) Array#length
  139550 ( 0.3%) Float#/
  139146 ( 0.3%) Float#<=>
  135569 ( 0.3%) String#==
  135303 ( 0.3%) Kernel#freeze
  134370 ( 0.3%) Module#===
  126941 ( 0.3%) Integer#>=
  125101 ( 0.3%) Kernel#initialize_copy
  124974 ( 0.3%) HexaPDF::Layout::TextLayouter::Glue#item
  124466 ( 0.3%) Geom2D::Algorithms::PolygonOperation::SweepEvent#polygon_type
   99694 ( 0.2%) NilClass#nil?
   94196 ( 0.2%) HexaPDF::Layout::Line#items
   74046 ( 0.2%) HexaPDF::Content::GraphicsState#tm=
   74046 ( 0.2%) Enumerable#each_with_index
   73232 ( 0.2%) HexaPDF::Layout::Line#y_offset=
   72670 ( 0.2%) String#initialize_copy
   72625 ( 0.2%) String#b
   72418 ( 0.2%) HexaPDF::Content::TransformationMatrix#e
   72418 ( 0.2%) HexaPDF::Content::TransformationMatrix#f
   72201 ( 0.2%) Hash#[]=
   71604 ( 0.2%) HexaPDF::Content::Canvas#operators
   71027 ( 0.2%) String#gsub!
   70971 ( 0.2%) String#encoding
   66479 ( 0.1%) Hash#key?
   65592 ( 0.1%) Integer#<=
   51058 ( 0.1%) Array#initialize_copy
   51055 ( 0.1%) HexaPDF::Layout::TextFragment#items=
   47287 ( 0.1%) Kernel#block_given?
   47132 ( 0.1%) String#getbyte
   45558 ( 0.1%) Geom2D::BoundingBox#max_x
   45556 ( 0.1%) Geom2D::Algorithms::PolygonOperation::SweepEvent#edge_type
   44746 ( 0.1%) Geom2D::Algorithms::PolygonOperation::SweepEvent#other_in_out
   43932 ( 0.1%) Array#insert
   43932 ( 0.1%) Array#bsearch_index
   39301 ( 0.1%) HexaPDF::PDFData#oid
   35958 ( 0.1%) HexaPDF::Font::InvalidGlyph#str

liquid-render

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/liquid-render/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
itr #1: 3084ms
Top 10 block calls by C methods (100.0% of all 136409 calls):
   57285 (42.0%) Array#each
   35200 (25.8%) Array#find_index
   30800 (22.6%) Array#each_index
    6160 ( 4.5%) Array#map
    4700 ( 3.4%) Kernel#loop
    1760 ( 1.3%) Hash#reject
     420 ( 0.3%) Hash#each
      57 ( 0.0%) Hash#each_key
      20 ( 0.0%) Integer#times
       7 ( 0.0%) Array#select

Top 100 C method calls (99.9% of all 1626030 calls):
  241047 (14.8%) Kernel#respond_to?
  143341 ( 8.8%) Array#[]
  114997 ( 7.1%) Kernel#is_a?
  103104 ( 6.3%) Hash#[]
   98563 ( 6.1%) Integer#+
   88440 ( 5.4%) Liquid::Context#resource_limits
   81667 ( 5.0%) Kernel#instance_of?
   71220 ( 4.4%) BasicObject#!
   70660 ( 4.3%) String#<<
   61177 ( 3.8%) Hash#key?
   58861 ( 3.6%) NilClass#nil?
   57206 ( 3.5%) Array#each
   48640 ( 3.0%) String#to_s
   46361 ( 2.9%) Kernel#nil?
   42700 ( 2.6%) Array#empty?
   33860 ( 2.1%) Array#each_index
   33580 ( 2.1%) Array#find_index
   30060 ( 1.8%) Liquid::Context#global_filter
   19707 ( 1.2%) Array#map
   11960 ( 0.7%) Array#length
   11880 ( 0.7%) Integer#==
    8158 ( 0.5%) Hash#[]=
    7760 ( 0.5%) Module#===
    7200 ( 0.4%) BasicObject#!=
    6100 ( 0.4%) Liquid::Context#registers
    5340 ( 0.3%) Integer#to_s
    4700 ( 0.3%) Kernel#loop
    4700 ( 0.3%) Liquid::Condition#operator
    4700 ( 0.3%) Liquid::Condition#right
    4700 ( 0.3%) Liquid::Condition#left
    4700 ( 0.3%) Liquid::Condition#child_relation
    4500 ( 0.3%) Integer#&
    4500 ( 0.3%) Integer#<<
    4080 ( 0.3%) Liquid::Context#strict_variables
    3825 ( 0.2%) Class#new
    3620 ( 0.2%) Integer#<=
    3360 ( 0.2%) Kernel#format
    3360 ( 0.2%) Integer#/
    3161 ( 0.2%) Integer#>
    3160 ( 0.2%) String#==
    3101 ( 0.2%) Array#<<
    2760 ( 0.2%) Array#shift
    2517 ( 0.2%) Array#last
    2480 ( 0.2%) #<Class:Regexp>#last_match
    2400 ( 0.1%) Liquid::Context#exception_renderer=
    2400 ( 0.1%) Kernel#freeze
    2380 ( 0.1%) BasicObject#==
    2340 ( 0.1%) Liquid::Condition#attachment
    2300 ( 0.1%) Array#first
    1660 ( 0.1%) String#=~
    1640 ( 0.1%) String#length
    1640 ( 0.1%) Regexp#===
    1521 ( 0.1%) Array#size
    1500 ( 0.1%) CGI::Escape#escapeHTML
    1460 ( 0.1%) String#+@
    1460 ( 0.1%) Integer#-
    1340 ( 0.1%) Liquid::Drop#context=
    1280 ( 0.1%) Array#unshift
    1280 ( 0.1%) Liquid::Context#base_scope_depth
    1280 ( 0.1%) Integer#<
    1220 ( 0.1%) String#gsub!
    1200 ( 0.1%) #<Class:Liquid::Template>#default_exception_renderer
    1200 ( 0.1%) Liquid::Context#errors
    1200 ( 0.1%) Array#flatten!
    1200 ( 0.1%) Hash#each_key
    1200 ( 0.1%) Enumerable#flat_map
    1120 ( 0.1%) Array#hash
    1120 ( 0.1%) String#empty?
    1119 ( 0.1%) Array#eql?
    1100 ( 0.1%) Array#push
    1100 ( 0.1%) Array#pop
     900 ( 0.1%) String#concat
     860 ( 0.1%) String#gsub
     800 ( 0.0%) String#===
     780 ( 0.0%) String#bytesize
     720 ( 0.0%) Liquid::Context#strict_filters
     720 ( 0.0%) Regexp#match
     700 ( 0.0%) String#[]
     561 ( 0.0%) Array#join
     560 ( 0.0%) Time#strftime
     560 ( 0.0%) String#downcase
     480 ( 0.0%) MatchData#begin
     480 ( 0.0%) MatchData#end
     480 ( 0.0%) String#[]=
     460 ( 0.0%) String#split
     280 ( 0.0%) String#strip
     280 ( 0.0%) Integer#to_f
     280 ( 0.0%) NilClass#===
     280 ( 0.0%) String#scan
     240 ( 0.0%) Kernel#block_given?
     240 ( 0.0%) Time#getlocal
     240 ( 0.0%) #<Class:Time>#local
     240 ( 0.0%) #<Class:Date>#_parse
     201 ( 0.0%) Integer#>=
     141 ( 0.0%) Integer#*
     140 ( 0.0%) Float#/
     140 ( 0.0%) Array#reverse!
     140 ( 0.0%) String#+
     140 ( 0.0%) Array#include?
     140 ( 0.0%) Float#ceil

mail

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/mail/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
itr #1: 4419ms
Top 9 block calls by C methods (100.0% of all 49451 calls):
   42500 (85.9%) Array#select
    4150 ( 8.4%) Array#each
     800 ( 1.6%) Hash#each
     750 ( 1.5%) Array#map
     450 ( 0.9%) Array#reject
     450 ( 0.9%) Hash#each_pair
     300 ( 0.6%) Array#map!
      50 ( 0.1%) Integer#times
       1 ( 0.0%) Thread::Mutex#synchronize

Top 100 C method calls (98.6% of all 3330188 calls):
  676545 (20.3%) Array#[]
  405615 (12.2%) Integer#<=
  287829 ( 8.6%) Integer#==
  249882 ( 7.5%) Integer#+
  161386 ( 4.8%) BasicObject#!=
  151200 ( 4.5%) #<Class:Mail::Parsers::ReceivedParser>#_trans_keys
   98650 ( 3.0%) String#to_s
   86494 ( 2.6%) Integer#>
   85143 ( 2.6%) Integer#-
   79893 ( 2.4%) String#[]
   79893 ( 2.4%) Integer#<<
   79893 ( 2.4%) String#ord
   76700 ( 2.3%) #<Class:Mail::Parsers::ReceivedParser>#_trans_actions
   50400 ( 1.5%) #<Class:Mail::Parsers::ReceivedParser>#_indicies
   50400 ( 1.5%) #<Class:Mail::Parsers::ReceivedParser>#_trans_targs
   50400 ( 1.5%) #<Class:Mail::Parsers::ReceivedParser>#_index_offsets
   50400 ( 1.5%) #<Class:Mail::Parsers::ReceivedParser>#_key_spans
   42500 ( 1.3%) String#casecmp
   27729 ( 0.8%) #<Class:Mail::Parsers::MessageIdsParser>#_trans_keys
   23900 ( 0.7%) Kernel#kind_of?
   23250 ( 0.7%) #<Class:Mail::Parsers::AddressListsParser>#_trans_keys
   20850 ( 0.6%) #<Class:Mail::Parsers::ContentTypeParser>#_trans_keys
   16600 ( 0.5%) BasicObject#!
   14600 ( 0.4%) Regexp#===
   11350 ( 0.3%) String#downcase
   10601 ( 0.3%) Kernel#respond_to?
   10500 ( 0.3%) #<Class:Mail::Parsers::ContentTransferEncodingParser>#_trans_keys
   10243 ( 0.3%) #<Class:Mail::Parsers::MessageIdsParser>#_trans_actions
   10150 ( 0.3%) String#=~
    9650 ( 0.3%) Array#empty?
    9243 ( 0.3%) #<Class:Mail::Parsers::MessageIdsParser>#_key_spans
    9243 ( 0.3%) #<Class:Mail::Parsers::MessageIdsParser>#_trans_targs
    9243 ( 0.3%) #<Class:Mail::Parsers::MessageIdsParser>#_indicies
    9243 ( 0.3%) #<Class:Mail::Parsers::MessageIdsParser>#_index_offsets
    9200 ( 0.3%) #<Class:Mail::Parsers::AddressListsParser>#_trans_actions
    8100 ( 0.2%) #<Class:Mail::Parsers::ContentTypeParser>#_trans_actions
    7750 ( 0.2%) #<Class:Mail::Parsers::AddressListsParser>#_key_spans
    7750 ( 0.2%) #<Class:Mail::Parsers::AddressListsParser>#_index_offsets
    7750 ( 0.2%) #<Class:Mail::Parsers::AddressListsParser>#_trans_targs
    7750 ( 0.2%) #<Class:Mail::Parsers::AddressListsParser>#_indicies
    7650 ( 0.2%) String#force_encoding
    7401 ( 0.2%) Kernel#is_a?
    7250 ( 0.2%) Array#first
    6950 ( 0.2%) #<Class:Mail::Parsers::ContentTypeParser>#_indicies
    6950 ( 0.2%) #<Class:Mail::Parsers::ContentTypeParser>#_key_spans
    6950 ( 0.2%) #<Class:Mail::Parsers::ContentTypeParser>#_index_offsets
    6950 ( 0.2%) #<Class:Mail::Parsers::ContentTypeParser>#_trans_targs
    6700 ( 0.2%) Integer#<
    6602 ( 0.2%) Class#new
    6350 ( 0.2%) Kernel#dup
    6350 ( 0.2%) Kernel#initialize_dup
    6200 ( 0.2%) String#initialize_copy
    6100 ( 0.2%) Hash#[]
    6100 ( 0.2%) Array#select
    6050 ( 0.2%) String#tr
    6050 ( 0.2%) Kernel#!~
    5850 ( 0.2%) Comparable#<
    5700 ( 0.2%) #<Class:Mail::Parsers::ContentDispositionParser>#_trans_keys
    5050 ( 0.2%) Regexp#to_s
    4950 ( 0.1%) String#<<
    4850 ( 0.1%) String#length
    4750 ( 0.1%) String#gsub!
    4600 ( 0.1%) Integer#div
    4500 ( 0.1%) Symbol#to_s
    4450 ( 0.1%) Array#length
    4300 ( 0.1%) String#downcase!
    4250 ( 0.1%) String#gsub
    4200 ( 0.1%) Mail::UnstructuredField#charset
    4200 ( 0.1%) Regexp#match
    4000 ( 0.1%) #<Class:Encoding>#find
    3900 ( 0.1%) Integer#<=>
    3850 ( 0.1%) #<Class:Mail::Parsers::ContentTransferEncodingParser>#_trans_actions
    3500 ( 0.1%) #<Class:Mail::Parsers::ContentTransferEncodingParser>#_trans_targs
    3500 ( 0.1%) #<Class:Mail::Parsers::ContentTransferEncodingParser>#_index_offsets
    3500 ( 0.1%) #<Class:Mail::Parsers::ContentTransferEncodingParser>#_key_spans
    3500 ( 0.1%) #<Class:Mail::Parsers::ContentTransferEncodingParser>#_indicies
    3250 ( 0.1%) String#slice
    3100 ( 0.1%) String#encoding
    2800 ( 0.1%) String#strip
    2800 ( 0.1%) String#index
    2750 ( 0.1%) Kernel#nil?
    2500 ( 0.1%) BasicObject#==
    2300 ( 0.1%) #<Class:Mail::Parsers::ContentDispositionParser>#_trans_actions
    2150 ( 0.1%) Array#each
    2050 ( 0.1%) String#empty?
    2000 ( 0.1%) Array#shift
    2000 ( 0.1%) Encoding#to_s
    2000 ( 0.1%) #<Class:Mail::Ruby19>#charset_encoder
    2000 ( 0.1%) String#<=>
    2000 ( 0.1%) String#encode
    1900 ( 0.1%) String#split
    1900 ( 0.1%) #<Class:Mail::Parsers::ContentDispositionParser>#_trans_targs
    1900 ( 0.1%) #<Class:Mail::Parsers::ContentDispositionParser>#_index_offsets
    1900 ( 0.1%) #<Class:Mail::Parsers::ContentDispositionParser>#_indicies
    1900 ( 0.1%) #<Class:Mail::Parsers::ContentDispositionParser>#_key_spans
    1800 ( 0.1%) Struct#initialize
    1750 ( 0.1%) String#ascii_only?
    1750 ( 0.1%) String#rstrip
    1700 ( 0.1%) Array#include?
    1650 ( 0.0%) String#==

psych-load

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/psych-load/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
itr #1: 46972ms
Top 3 block calls by C methods (100.0% of all 535404 calls):
  535300 (100.0%) Array#each
     100 ( 0.0%) Integer#times
       4 ( 0.0%) Hash#[]

Top 66 C method calls (100.0% of all 23760136 calls):
 2067900 ( 8.7%) Hash#[]
 1942700 ( 8.2%) BasicObject#!
 1500800 ( 6.3%) Psych::Nodes::Scalar#tag
 1124600 ( 4.7%) Psych::Nodes::Node#children
 1035901 ( 4.4%) Class#new
 1034100 ( 4.4%) Hash#empty?
 1034100 ( 4.4%) Psych::Nodes::Node#start_line=
 1034100 ( 4.4%) Psych::Nodes::Node#start_column=
 1033801 ( 4.4%) Array#<<
 1033800 ( 4.4%) Psych::Nodes::Node#end_column=
 1033800 ( 4.4%) Psych::Nodes::Node#end_line=
  952600 ( 4.0%) String#match?
  945700 ( 4.0%) Psych::Visitors::ToRuby#class_loader
  943300 ( 4.0%) Psych::Nodes::Scalar#quoted
  943300 ( 4.0%) Psych::Nodes::Scalar#anchor
  943300 ( 4.0%) Psych::Nodes::Scalar#value
  579000 ( 2.4%) String#==
  557500 ( 2.3%) String#empty?
  557300 ( 2.3%) Hash#key?
  556601 ( 2.3%) Integer#>
  556600 ( 2.3%) String#length
  498504 ( 2.1%) Hash#[]=
  498500 ( 2.1%) String#-@
  498500 ( 2.1%) Kernel#is_a?
  176200 ( 0.7%) Psych::Nodes::Mapping#tag
  127600 ( 0.5%) Array#push
   90800 ( 0.4%) Array#pop
   90800 ( 0.4%) Array#last
   90600 ( 0.4%) Array#each
   88101 ( 0.4%) Array#size
   88100 ( 0.4%) Psych::Nodes::Mapping#anchor
   88100 ( 0.4%) Enumerable#each_slice
    4800 ( 0.0%) Psych::Nodes::Sequence#tag
    2400 ( 0.0%) NilClass#===
    2400 ( 0.0%) Psych::Nodes::Sequence#anchor
     600 ( 0.0%) Array#map
     300 ( 0.0%) #<Class:0x00000001040e13a0>::Config#domain_types
     300 ( 0.0%) #<Class:0x00000001040e13a0>::Config#load_tags
     300 ( 0.0%) BasicObject#initialize
     300 ( 0.0%) Hash#initialize_copy
     300 ( 0.0%) Kernel#initialize_dup
     300 ( 0.0%) Kernel#dup
     300 ( 0.0%) Module#to_s
     300 ( 0.0%) Psych::Nodes::Document#implicit_end=
     300 ( 0.0%) Psych::Parser#parse
     300 ( 0.0%) Kernel#block_given?
     300 ( 0.0%) Array#first
       4 ( 0.0%) String#gsub
       4 ( 0.0%) Module#name
       3 ( 0.0%) Integer#+
       2 ( 0.0%) #<Class:Process>#clock_gettime
       1 ( 0.0%) Float#-
       1 ( 0.0%) Integer#*
       1 ( 0.0%) Hash#compare_by_identity
       1 ( 0.0%) Hash#initialize
       1 ( 0.0%) Float#to_i
       1 ( 0.0%) Kernel#puts
       1 ( 0.0%) IO#puts
       1 ( 0.0%) IO#write
       1 ( 0.0%) Integer#>=
       1 ( 0.0%) Array#join
       1 ( 0.0%) Float#>=
       1 ( 0.0%) Float#to_s
       1 ( 0.0%) #<Class:IO>#write
       1 ( 0.0%) Array#[]
       1 ( 0.0%) Integer#times

railsbench

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/railsbench/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
Command: bin/rails db:migrate db:seed
Using 100 posts in the database
itr #1: 20720ms
Top 41 block calls by C methods (100.0% of all 805035 calls):
  224448 (27.9%) Array#each
  155760 (19.3%) Hash#each_pair
   83229 (10.3%) Hash#each
   53766 ( 6.7%) ActiveSupport::OrderedOptions#[]
   39740 ( 4.9%) Hash#transform_keys!
   37946 ( 4.7%) Array#map
   32221 ( 4.0%) Monitor#synchronize
   29970 ( 3.7%) Array#reject!
   19301 ( 2.4%) Hash#each_key
   18348 ( 2.3%) Hash#delete_if
   17949 ( 2.2%) Hash#fetch
   13969 ( 1.7%) Array#any?
    9970 ( 1.2%) Array#select
    9075 ( 1.1%) Hash#[]
    7070 ( 0.9%) Integer#times
    6533 ( 0.8%) #<Class:Thread>#handle_interrupt
    6000 ( 0.7%) String#sub
    5983 ( 0.7%) Hash#each_value
    4026 ( 0.5%) Array#initialize
    4002 ( 0.5%) BasicObject#instance_exec
    4000 ( 0.5%) Array#all?
    3971 ( 0.5%) Array#map!
    3970 ( 0.5%) Array#zip
    2600 ( 0.3%) Array#reverse_each
    2600 ( 0.3%) Hash#keep_if
    2155 ( 0.3%) Thread::Mutex#synchronize
    2000 ( 0.2%) Hash#delete
    2000 ( 0.2%) Array#collect
    1983 ( 0.2%) Hash#transform_values
     325 ( 0.0%) Kernel#loop
      67 ( 0.0%) Enumerable#reverse_each
      19 ( 0.0%) String#scan
      15 ( 0.0%) Array#reject
       9 ( 0.0%) Kernel#catch
       4 ( 0.0%) Hash#transform_keys
       3 ( 0.0%) Module#class_eval
       3 ( 0.0%) Class#initialize
       2 ( 0.0%) String#gsub!
       1 ( 0.0%) String#sub!
       1 ( 0.0%) Module#initialize
       1 ( 0.0%) Hash#select

Top 100 C method calls (84.9% of all 9530341 calls):
 1105900 (11.6%) Hash#[]
  453811 ( 4.8%) Hash#[]=
  350840 ( 3.7%) Hash#fetch
  348210 ( 3.7%) Module#===
  344733 ( 3.6%) String#to_s
  305403 ( 3.2%) Class#new
  215855 ( 2.3%) BasicObject#!
  197383 ( 2.1%) Kernel#is_a?
  143338 ( 1.5%) Kernel#initialize_dup
  143332 ( 1.5%) Kernel#dup
  130418 ( 1.4%) Array#each
  128396 ( 1.3%) Kernel#nil?
  127168 ( 1.3%) String#getbyte
  127116 ( 1.3%) String#==
  118219 ( 1.2%) Array#[]
  116544 ( 1.2%) #<Class:Thread>#current
  114213 ( 1.2%) Kernel#respond_to?
  106518 ( 1.1%) Hash#key?
  105765 ( 1.1%) Integer#+
  101810 ( 1.1%) Integer#<
   98206 ( 1.0%) String#empty?
   94699 ( 1.0%) Kernel#block_given?
   93628 ( 1.0%) ActiveSupport::OrderedOptions#[]
   92093 ( 1.0%) Thread#[]
   90291 ( 0.9%) Array#empty?
   82735 ( 0.9%) BasicObject#==
   75565 ( 0.8%) String#gsub!
   74273 ( 0.8%) Symbol#to_s
   71723 ( 0.8%) String#initialize
   71216 ( 0.7%) Hash#initialize_copy
   70454 ( 0.7%) Array#hash
   70357 ( 0.7%) Hash#delete
   63584 ( 0.7%) Integer#^
   63584 ( 0.7%) String#setbyte
   62658 ( 0.7%) ActionController::Metal#_request
   60265 ( 0.6%) String#<<
   58030 ( 0.6%) ActiveModel::LazyAttributeHash#delegate_hash
   56920 ( 0.6%) Kernel#hash
   55511 ( 0.6%) Array#map
   48763 ( 0.5%) ActionView::Helpers::ControllerHelper#_controller
   47772 ( 0.5%) Array#include?
   46463 ( 0.5%) Hash#empty?
   45231 ( 0.5%) #<Class:Process>#clock_gettime
   44878 ( 0.5%) Array#eql?
   44639 ( 0.5%) Array#any?
   44591 ( 0.5%) Array#first
   44012 ( 0.5%) Kernel#kind_of?
   43701 ( 0.5%) Integer#==
   42172 ( 0.4%) CGI::Escape#escapeHTML
   41090 ( 0.4%) Hash#each
   40026 ( 0.4%) ActiveModel::Attribute#type
   39388 ( 0.4%) Kernel#public_send
   37966 ( 0.4%) ActiveModel::Attribute#value_before_type_cast
   37952 ( 0.4%) String#downcase
   37753 ( 0.4%) ActionDispatch::Cookies::CookieJar#request
   37438 ( 0.4%) String#initialize_copy
   36112 ( 0.4%) BasicObject#initialize
   35569 ( 0.4%) ActiveModel::AttributeSet#attributes
   35470 ( 0.4%) JSON::Ext::Generator::GeneratorMethods::String#to_json
   35470 ( 0.4%) #<Class:ActiveSupport::JSON::Encoding>#escape_html_entities_in_json
   35102 ( 0.4%) Regexp#match?
   33984 ( 0.4%) Array#initialize_copy
   33706 ( 0.4%) ActiveSupport::SafeBuffer#concat
   32961 ( 0.3%) Hash#merge
   32221 ( 0.3%) Monitor#synchronize
   31574 ( 0.3%) Module#==
   31162 ( 0.3%) String#scrub
   30257 ( 0.3%) Class#superclass
   29934 ( 0.3%) Array#unshift
   29922 ( 0.3%) Hash#initialize
   28130 ( 0.3%) String#freeze
   27997 ( 0.3%) Array#[]=
   27899 ( 0.3%) Array#pop
   27777 ( 0.3%) Kernel#freeze
   27691 ( 0.3%) #<Class:ActiveSupport::Notifications>#notifier
   27674 ( 0.3%) Array#last
   27010 ( 0.3%) Kernel#instance_variable_defined?
   26923 ( 0.3%) BasicObject#!=
   26732 ( 0.3%) Hash#each_pair
   26392 ( 0.3%) Array#join
   25341 ( 0.3%) String#concat
   25192 ( 0.3%) NilClass#nil?
   24637 ( 0.3%) String#split
   24546 ( 0.3%) NilClass#===
   24494 ( 0.3%) Hash#merge!
   23600 ( 0.2%) String#force_encoding
   22480 ( 0.2%) ActiveModel::LazyAttributeHash#types
   22480 ( 0.2%) ActiveModel::LazyAttributeHash#values
   22480 ( 0.2%) ActiveModel::LazyAttributeHash#additional_types
   22307 ( 0.2%) String#to_i
   22261 ( 0.2%) Array#size
   21987 ( 0.2%) Hash#to_hash
   21897 ( 0.2%) Hash#default
   20000 ( 0.2%) ActionDispatch::Response#header
   19910 ( 0.2%) Hash#default_proc
   19300 ( 0.2%) MatchData#[]
   19292 ( 0.2%) Regexp#match
   17970 ( 0.2%) ActionController::Metal#_response
   17949 ( 0.2%) ActiveSupport::ParameterFilter::CompiledFilter#deep_regexps
   17352 ( 0.2%) ActiveModel::Attribute#name

ruby-lsp

$ WARMUP_ITRS=0 MIN_BENCH_ITRS=1 MIN_BENCH_TIME=0 ruby -Iharness-cstats benchmarks/ruby-lsp/benchmark.rb
ruby 3.2.0dev (2022-12-22T00:27:38Z master 99cee85775) [arm64-darwin22]
Command: bundle check 2> /dev/null || bundle install
The Gemfile's dependencies are satisfied
itr #1: 6731ms
Top 56 block calls by C methods (100.0% of all 403539 calls):
  280215 (69.4%) Array#each
   47382 (11.7%) Array#select
   18163 ( 4.5%) Array#map
   11496 ( 2.8%) Array#any?
    8283 ( 2.1%) Array#rindex
    8233 ( 2.0%) Array#map!
    7376 ( 1.8%) Array#bsearch_index
    4737 ( 1.2%) Hash#each
    2907 ( 0.7%) Hash#[]
    2498 ( 0.6%) String#gsub
    2145 ( 0.5%) Array#delete_if
    1662 ( 0.4%) Hash#each_key
    1348 ( 0.3%) Hash#fetch
     915 ( 0.2%) BasicObject#instance_exec
     903 ( 0.2%) Array#reverse_each
     872 ( 0.2%) Hash#each_pair
     798 ( 0.2%) Array#each_index
     676 ( 0.2%) Array#reject!
     574 ( 0.1%) Array#reject
     320 ( 0.1%) Array#index
     281 ( 0.1%) Range#each
     259 ( 0.1%) String#each_line
     212 ( 0.1%) Array#all?
     198 ( 0.0%) #<Class:IO>#foreach
     194 ( 0.0%) Array#select!
     179 ( 0.0%) Module#module_eval
     128 ( 0.0%) Range#bsearch
      93 ( 0.0%) Module#module_exec
      80 ( 0.0%) Hash#each_value
      58 ( 0.0%) Array#drop_while
      58 ( 0.0%) Array#zip
      48 ( 0.0%) Module#class_eval
      35 ( 0.0%) Integer#upto
      29 ( 0.0%) Hash#select
      19 ( 0.0%) Class#initialize
      18 ( 0.0%) Array#count
      18 ( 0.0%) Enumerator::Yielder#<<
      18 ( 0.0%) Kernel#require
      15 ( 0.0%) Hash#merge!
      15 ( 0.0%) Integer#downto
      13 ( 0.0%) Array#to_h
      13 ( 0.0%) String#sub
      12 ( 0.0%) #<Class:Struct>#new
       7 ( 0.0%) Array#fetch
       6 ( 0.0%) Module#refine
       6 ( 0.0%) Hash#transform_values
       5 ( 0.0%) Kernel#catch
       4 ( 0.0%) Array#take_while
       4 ( 0.0%) #<Class:Dir>#chdir
       2 ( 0.0%) Kernel#loop
       2 ( 0.0%) Thread::Mutex#synchronize
       2 ( 0.0%) BasicObject#instance_eval
       2 ( 0.0%) Integer#times
       1 ( 0.0%) #<Class:IO>#open
       1 ( 0.0%) Kernel#require_relative
       1 ( 0.0%) Module#initialize

Top 100 C method calls (93.2% of all 3190764 calls):
  305572 ( 9.6%) Psych::Nodes::Scalar#value
  176300 ( 5.5%) String#==
  164582 ( 5.2%) RuboCop::AST::NodePattern::LexerRex#ss
  158085 ( 5.0%) Array#[]
  139667 ( 4.4%) Integer#+
  116768 ( 3.7%) Hash#[]
  104428 ( 3.3%) StringScanner#skip
   75888 ( 2.4%) Kernel#is_a?
   68923 ( 2.2%) String#empty?
   62047 ( 1.9%) Class#new
   60653 ( 1.9%) Symbol#==
   60348 ( 1.9%) Integer#<=
   54673 ( 1.7%) AST::Node#children
   53105 ( 1.7%) AST::Node#type
   53049 ( 1.7%) Array#<<
   49752 ( 1.6%) Integer#==
   45698 ( 1.4%) Symbol#match?
   45303 ( 1.4%) BasicObject#!
   32506 ( 1.0%) Array#size
   31201 ( 1.0%) RuboCop::AST::NodePattern::Compiler::Subcompiler#node
   31167 ( 1.0%) StringScanner#eos?
   30148 ( 0.9%) Psych::Nodes::Node#children
   29469 ( 0.9%) Array#[]=
   28255 ( 0.9%) String#to_i
   27414 ( 0.9%) Kernel#freeze
   25601 ( 0.8%) Array#hash
   25083 ( 0.8%) Integer#>
   25060 ( 0.8%) Integer#-
   23675 ( 0.7%) BasicObject#!=
   23372 ( 0.7%) Psych::Nodes::Node#start_column=
   23372 ( 0.7%) Psych::Nodes::Node#start_line=
   23344 ( 0.7%) Psych::Nodes::Node#end_column=
   23344 ( 0.7%) Psych::Nodes::Node#end_line=
   23195 ( 0.7%) Module#===
   22916 ( 0.7%) Integer#>=
   22843 ( 0.7%) Array#each
   22809 ( 0.7%) Range#begin
   22678 ( 0.7%) Kernel#block_given?
   22516 ( 0.7%) Array#empty?
   22065 ( 0.7%) Psych::Nodes::Scalar#tag
   20530 ( 0.6%) Kernel#nil?
   20157 ( 0.6%) Hash#fetch
   19822 ( 0.6%) Range#max
   19635 ( 0.6%) Hash#[]=
   19134 ( 0.6%) RuboCop::AST::NodePattern::LexerRex#state
   17175 ( 0.5%) Kernel#hash
   16995 ( 0.5%) Array#first
   16970 ( 0.5%) StringScanner#matched
   16168 ( 0.5%) Symbol#===
   15256 ( 0.5%) #<Class:RuboCop::AST::NodePattern::Compiler::Subcompiler>#registry
   15142 ( 0.5%) RuboCop::AST::Token#type
   14863 ( 0.5%) Hash#empty?
   14433 ( 0.5%) String#match?
   14398 ( 0.5%) Module#method_added
   14265 ( 0.4%) String#to_sym
   13658 ( 0.4%) Array#last
   13396 ( 0.4%) Array#map
   13369 ( 0.4%) RuboCop::AST::NodePattern::Compiler::Subcompiler#compiler
   12930 ( 0.4%) Psych::Visitors::ToRuby#class_loader
   12739 ( 0.4%) RuboCop::Cop::Badge#department
   12380 ( 0.4%) Integer#<
   12362 ( 0.4%) Psych::Nodes::Scalar#quoted
   12362 ( 0.4%) Psych::Nodes::Scalar#anchor
   12088 ( 0.4%) Kernel#respond_to?
   12033 ( 0.4%) StringScanner#[]
   11866 ( 0.4%) Hash#key?
   11321 ( 0.4%) Parser::AST::Node#location
   11216 ( 0.4%) Kernel#public_send
   10397 ( 0.3%) String#length
   10034 ( 0.3%) Array#to_a
    9589 ( 0.3%) Array#include?
    9238 ( 0.3%) AST::Node#hash
    9038 ( 0.3%) Integer#<<
    8711 ( 0.3%) Array#shift
    8508 ( 0.3%) RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler#access
    8448 ( 0.3%) Array#push
    8427 ( 0.3%) BasicObject#equal?
    7387 ( 0.2%) Array#join
    7231 ( 0.2%) Integer#<=>
    6911 ( 0.2%) String#[]
    6503 ( 0.2%) Symbol#<=>
    6389 ( 0.2%) RuboCop::Cop::Badge#cop_name
    6291 ( 0.2%) String#-@
    6001 ( 0.2%) Integer#===
    5927 ( 0.2%) NilClass#nil?
    5709 ( 0.2%) Symbol#to_s
    5610 ( 0.2%) Module#const_added
    4948 ( 0.2%) Array#any?
    4855 ( 0.2%) RuboCop::AST::NodePattern::Compiler::NodePatternSubcompiler#seq_head
    4648 ( 0.1%) Parser::Source::Range#begin_pos
    4566 ( 0.1%) SyntaxTree::Op#value
    4377 ( 0.1%) Enumerable#find
    4337 ( 0.1%) BasicObject#==
    4313 ( 0.1%) Numeric#negative?
    4211 ( 0.1%) String#split
    3667 ( 0.1%) Parser::Source::Range#end_pos
    3448 ( 0.1%) Integer#/
    3448 ( 0.1%) Integer#%
    3387 ( 0.1%) Array#map!
    3269 ( 0.1%) Kernel#initialize_dup

@k0kubun k0kubun requested a review from a team December 21, 2022 22:06
@k0kubun
Copy link
Member Author

k0kubun commented Dec 21, 2022

The "C loop method iterations" part might be also useful for reducing the number of exits due to interp_return (which we currently don't consider as side exits). We want such methods to be rewritten in Ruby.

Copy link
Contributor

@maximecb maximecb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool!

I have one feature request: when listing the C method calls, can you also list the percentage of total C calls that it represents in parentheses. Might also be nice to show the total count of C calls before the list.

e.g.
Total C calls: 140308043 (100%)
115300 Kernel#is_a? (2.3%)

@k0kubun
Copy link
Member Author

k0kubun commented Dec 22, 2022

Nice suggestion 👍 I implemented that in ccf8b44. I also added the results for all headline benchmarks with the latest Ruby in the PR description for convenience.

@noahgibbs
Copy link
Contributor

This looks good to me, and definitely harmless since it's a new separate harness. I'll merge.

@noahgibbs noahgibbs merged commit 342d713 into ruby:main Jan 3, 2023
@k0kubun k0kubun deleted the harness-cstats branch January 3, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants