ruby/benchmark
Jean Boussier 9e9f1d9301 Precompute embedded string literals hash code
With embedded strings we often have some space left in the slot, which
we can use to store the string Hash code.

It's probably only worth it for string literals, as they are the ones
likely to be used as hash keys.

We chose to store the Hash code right after the string terminator as to
make it easy/fast to compute, and not require one more union in RString.

```
compare-ruby: ruby 3.4.0dev (2024-04-22T06:32:21Z main f77618c1fa) [arm64-darwin23]
built-ruby: ruby 3.4.0dev (2024-04-22T10:13:03Z interned-string-ha.. 8a1a32331b) [arm64-darwin23]
last_commit=Precompute embedded string literals hash code

|            |compare-ruby|built-ruby|
|:-----------|-----------:|---------:|
|symbol      |     39.275M|   39.753M|
|            |           -|     1.01x|
|dyn_symbol  |     37.348M|   37.704M|
|            |           -|     1.01x|
|small_lit   |     29.514M|   33.948M|
|            |           -|     1.15x|
|frozen_lit  |     27.180M|   33.056M|
|            |           -|     1.22x|
|iseq_lit    |     27.391M|   32.242M|
|            |           -|     1.18x|
```

Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
2024-05-28 07:32:41 +02:00
..
gc don't use GC::Profiler on default. 2018-09-28 05:28:12 +00:00
lib Remove MJIT-specific benchmarks 2023-03-06 22:36:57 -08:00
other-lang n+1 to include n in range 2019-08-05 09:04:32 +09:00
README.md Update the help message on /benchmark 2022-06-07 21:30:28 -07:00
app_answer.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_aobench.rb benchmark/app_aobench.rb: complete commented code to write the image to a file 2019-01-21 12:31:29 +00:00
app_erb.yml benchmark/app_erb.yml: remove unused variable 2018-12-22 01:43:45 +00:00
app_factorial.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_fib.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_lc_fizzbuzz.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_mandelbrot.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_pentomino.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_raise.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_strconcat.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_tak.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_tarai.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
app_uri.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_flatten.yml Optimize Array#flatten and flatten! for already flattened arrays (#2495) 2019-09-28 01:24:24 +09:00
array_intersection.yml Benchmark for [Feature #16155] 2019-10-22 22:49:48 +09:00
array_large_literal.yml Optimize compilation of large literal arrays 2024-01-27 10:16:52 -08:00
array_max_float.yml Optimize Array#max (#3325) 2020-07-18 23:45:00 +09:00
array_max_int.yml Optimize Array#max (#3325) 2020-07-18 23:45:00 +09:00
array_max_str.yml Optimize Array#max (#3325) 2020-07-18 23:45:00 +09:00
array_min.yml Optimize Array#min (#3324) 2020-07-18 23:45:25 +09:00
array_sample.yml Skip string allocation in benchmark/time_at.yml 2021-11-14 23:25:25 -08:00
array_sample_100k_10.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sample_100k_11.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sample_100k__1k.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sample_100k__6k.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sample_100k__100.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sample_100k___10k.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sample_100k___50k.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_shift.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_small_and.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_small_diff.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_small_or.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sort_block.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sort_float.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_sort_int.yml Introduce BOP_CMP for optimized comparison 2022-12-06 12:37:23 -08:00
array_values_at_int.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
array_values_at_range.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
attr_accessor.yml Support tracing of attr_reader and attr_writer 2021-08-29 07:23:39 -07:00
bighash.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
buffer_each.yml Add several new methods for getting and setting buffer contents. (#6434) 2022-09-26 18:06:12 +13:00
buffer_get.yml Add several new methods for getting and setting buffer contents. (#6434) 2022-09-26 18:06:12 +13:00
cgi_escape_html.yml Improve HTML escape benchmarks 2022-11-04 23:54:25 -07:00
complex_float_add.yml benchmark/complex_float_*.yml: New benchmarks 2019-01-01 12:20:04 +00:00
complex_float_div.yml benchmark/complex_float_*.yml: New benchmarks 2019-01-01 12:20:04 +00:00
complex_float_mul.yml benchmark/complex_float_*.yml: New benchmarks 2019-01-01 12:20:04 +00:00
complex_float_new.yml benchmark/complex_float_*.yml: New benchmarks 2019-01-01 12:20:04 +00:00
complex_float_power.yml benchmark/complex_float_*.yml: New benchmarks 2019-01-01 12:20:04 +00:00
complex_float_sub.yml benchmark/complex_float_*.yml: New benchmarks 2019-01-01 12:20:04 +00:00
constant_invalidation.rb Finer-grained constant cache invalidation (take 2) 2022-04-01 14:48:22 -04:00
dir_empty_p.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
enum_lazy_flat_map.yml Improved Enumerable::Lazy#flat_map 2020-07-23 16:57:26 +09:00
enum_lazy_grep_v_20.rb Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining 2018-08-16 00:58:21 +00:00
enum_lazy_grep_v_50.rb Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining 2018-08-16 00:58:21 +00:00
enum_lazy_grep_v_100.rb Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining 2018-08-16 00:58:21 +00:00
enum_lazy_uniq_20.rb Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining 2018-08-16 00:58:21 +00:00
enum_lazy_uniq_50.rb Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining 2018-08-16 00:58:21 +00:00
enum_lazy_uniq_100.rb Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining 2018-08-16 00:58:21 +00:00
enum_lazy_zip.yml Improved Enumerable::Lazy#zip 2020-07-23 16:57:26 +09:00
enum_minmax.yml Introduce BOP_CMP for optimized comparison 2022-12-06 12:37:23 -08:00
enum_sort.yml Introduce BOP_CMP for optimized comparison 2022-12-06 12:37:23 -08:00
enum_sort_by.yml [Feature #19643] Direct primitive compare sort for `Array#sort_by` 2023-05-20 19:40:27 +09:00
enum_tally.yml Improve Enumerable#tally performance 2021-03-16 23:06:41 +09:00
erb_escape_html.yml Improve HTML escape benchmarks 2022-11-04 23:54:25 -07:00
erb_render.yml benchmark: revise ERB benchmarks using YAML syntax 2018-07-10 15:58:52 +00:00
fiber_chain.yml Drop executable bit of *.{yml,h,mk.tmpl} 2020-01-22 16:04:38 +09:00
fiber_locals.yml Let execution context local storage be an ID table 2020-01-11 14:40:36 +13:00
file_chmod.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
file_rename.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
float_methods.yml Improve performance some Float methods [Feature #17498] (#4018) 2021-01-01 18:39:07 -08:00
float_neg_posi.yml Improve performance Float#positive? and Float#negative? [Feature #17614] (#4160) 2021-02-08 20:29:42 -08:00
float_to_s.yml Simple benchmark of Float#to_s 2021-02-10 19:42:00 +09:00
hash_aref_array.rb Use faster any_hash logic in rb_hash 2021-09-30 13:06:53 -07:00
hash_aref_dsym.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_dsym_long.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_fix.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_flo.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_miss.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_str.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_str_lit.yml Precompute embedded string literals hash code 2024-05-28 07:32:41 +02:00
hash_aref_sym.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_aref_sym_long.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_defaults.yml Speeds up fallback to Hash#default_proc in rb_hash_aref by removing a method call 2020-01-08 18:09:52 +09:00
hash_dup.yml Stop making a redundant hash copy in Hash#dup (#2489) 2019-10-21 17:29:21 +09:00
hash_first.yml st.c: skip all deleted entries [Bug #17779] 2021-04-11 19:05:26 +09:00
hash_flatten.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_ident_flo.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_ident_num.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_ident_obj.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_ident_str.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_ident_sym.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_key.yml Optimize Hash methods with Kernel#hash (#10160) 2024-03-01 11:16:31 -08:00
hash_keys.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_literal_small2.rb Add benchmark for hash small literals 2018-12-06 18:20:11 +00:00
hash_literal_small4.rb Add benchmark for hash small literals 2018-12-06 18:20:11 +00:00
hash_literal_small8.rb Add benchmark for hash small literals 2018-12-06 18:20:11 +00:00
hash_long.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_shift.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_shift_u16.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_shift_u24.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_shift_u32.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_small2.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_small4.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_small8.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_to_proc.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
hash_values.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
int_quo.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_copy_stream_write.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_copy_stream_write_socket.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_file_create.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_file_read.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_file_write.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_nonblock_noex.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_nonblock_noex2.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_pipe_rw.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_select.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_select2.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_select3.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
io_write.rb Add IO write throughput/locking overhead benchmark. 2022-05-28 15:44:18 +12:00
irb_color.yml Add a benchmark using IRB::Color 2019-06-01 20:07:50 +09:00
irb_exec.yml Make sure to suppress .irbrc on benchmark 2019-06-10 22:04:52 +09:00
iseq_load_from_binary.yml Add a benchmark for RubyVM::InstructionSequence.load_from_binary 2021-03-10 13:44:07 -08:00
ivar_extend.yml Eagerly allocate instance variable tables along with object 2021-05-03 14:11:48 -07:00
kernel_clone.yml support builtin for Kernel#clone 2020-03-17 19:37:07 +09:00
kernel_float.yml support builtin for Kernel#Float 2020-04-22 09:49:13 +09:00
kernel_tap.yml Rewrite Kernel#tap with Ruby (#3281) 2020-07-03 09:52:35 -07:00
kernel_then.yml Make Kernel#then, #yield_self, #frozen? builtin (#3283) 2020-07-03 18:02:43 -07:00
keyword_arguments.yml Reduce allocations for keyword argument hashes 2020-03-17 12:09:43 -07:00
loop_each.yml Rewrite Array#each in Ruby using Primitive (#9533) 2024-01-23 20:09:57 +00:00
loop_for.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
loop_generator.rb Rewrite Kernel#loop in Ruby (#6983) 2022-12-25 21:46:29 -08:00
loop_times.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
loop_times_megamorphic.yml YJIT: Allow inlining ISEQ calls with a block (#9622) 2024-01-23 19:36:23 +00:00
loop_whileloop.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
loop_whileloop2.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
marshal_dump_flo.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
marshal_dump_load_geniv.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
marshal_dump_load_integer.yml Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229) 2022-08-15 16:14:12 -07:00
marshal_dump_load_time.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
masgn.yml Update multiple assignment benchmarks to include non-literal array cases 2022-08-09 22:19:46 -07:00
match_gt4.rb Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most pattern matches are less than or equal to 4 results 2019-05-07 21:58:55 +09:00
match_small.rb Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most pattern matches are less than or equal to 4 results 2019-05-07 21:58:55 +09:00
method_bind_call.yml proc.c: make bind_call use existing callable method entry when possible 2021-03-10 13:43:22 -08:00
module_eqq.yml Constant time class to class ancestor lookup 2022-02-23 19:57:42 -08:00
nil_p.yml Revert "Revert "Add a specialized instruction for `.nil?` calls"" 2019-08-02 23:25:38 +09:00
nilclass.yml Implemented some NilClass method in Ruby code is faster [Feature #17054] (#3366) 2021-06-02 20:04:56 -07:00
num_zero_p.yml Make Integer#zero? a separated method and builtin (#3226) 2020-06-20 14:55:09 -07:00
numeric_methods.yml Improve performance some `Integer` and `Float` methods [Feature #19085] (#6638) 2022-10-27 09:13:16 -07:00
object_allocate.yml add allocation benchmark 2024-04-15 11:29:48 -07:00
objspace_dump_all.yml Optimize ObjectSpace.dump_all 2020-09-09 11:11:36 -07:00
pm_array.yml Add pattern matching with arrays benchmark 2020-06-27 13:51:03 +09:00
ractor_const.yml Add a benchmark-driver runner for Ractor (#4172) 2021-02-10 21:24:25 -08:00
ractor_float_to_s.yml Add a benchmark-driver runner for Ractor (#4172) 2021-02-10 21:24:25 -08:00
range_bsearch_bignum.yml Add benchmarks for Range#bsearch 2023-09-26 17:31:10 +09:00
range_bsearch_endpointless.yml Add benchmarks for Range#bsearch 2023-09-26 17:31:10 +09:00
range_bsearch_fixnum.yml Add benchmarks for Range#bsearch 2023-09-26 17:31:10 +09:00
range_count.yml Optimize `Range#count` by using `range_size` if possible 2023-10-05 00:19:55 +09:00
range_last.yml benchmark/range_last.yml: remove needless prelude 2019-01-06 15:46:21 +00:00
range_min.yml Introduce BOP_CMP for optimized comparison 2022-12-06 12:37:23 -08:00
range_overlap.yml [Feature #19839] Fix `Range#overlap?` for empty ranges 2023-09-16 17:24:21 +09:00
range_reverse_each.yml Add benchmarks for Range#reverse_each 2023-10-12 17:34:49 +09:00
realpath.yml Fix a benchmark to avoid leaving a garbage file 2024-02-08 17:08:23 -08:00
regexp_dup.yml Optimize `Regexp#dup` and `Regexp.new(/RE/)` 2023-06-09 20:22:30 +09:00
regexp_new.yml Optimize `Regexp#dup` and `Regexp.new(/RE/)` 2023-06-09 20:22:30 +09:00
require.yml Close created files [ci skip] 2019-08-10 11:26:23 +09:00
require_thread.yml Close created files [ci skip] 2019-08-10 11:26:23 +09:00
securerandom.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_ackermann.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_array.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_binary_trees.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_concatenate.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_count_words.yml Clean up temporary file, wc.input [ci skip] 2023-10-24 12:30:10 +09:00
so_exception.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_fannkuch.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_fasta.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_k_nucleotide.yml benchmark: introduce benchmark_driver.gem 2018-07-08 14:38:05 +00:00
so_lists.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_mandelbrot.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_matrix.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_meteor_contest.rb Fix spelling (#7405) 2023-02-28 10:05:30 -08:00
so_nbody.rb Make benchmark indentation consistent 2022-08-19 14:44:08 -07:00
so_nested_loop.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_nsieve.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_nsieve_bits.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_object.rb delete emacs mode lines [ci skip] 2018-12-27 06:12:09 +00:00
so_partial_sums.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_pidigits.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_random.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_reverse_complement.yml benchmark: introduce benchmark_driver.gem 2018-07-08 14:38:05 +00:00
so_sieve.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
so_spectralnorm.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
string_capitalize.yml Improve performance of case-conversion methods 2019-05-03 23:59:18 +09:00
string_casecmp.yml Added more benchmarks for String 2020-02-29 15:42:24 +09:00
string_casecmp_p.yml Added more benchmarks for String 2020-02-29 15:42:24 +09:00
string_concat.yml Benchmark String interpolation across size pools 2023-01-13 10:31:35 -05:00
string_downcase.yml Added more benchmarks for String 2020-02-29 15:42:24 +09:00
string_dup.yml Specialize String#dup 2023-11-20 14:33:20 +01:00
string_index.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
string_rpartition.yml Make `rb_str_rindex` return byte index 2023-07-09 16:39:28 +09:00
string_scan_re.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
string_scan_str.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
string_slice.yml Improve `String#slice!` performance 2020-01-31 17:12:05 +09:00
string_split.yml Added String#split benchmark for empty regexp 2020-05-12 22:59:58 +09:00
string_swapcase.yml Added more benchmarks for String 2020-02-29 15:42:24 +09:00
string_upcase.yml Added more benchmarks for String 2020-02-29 15:42:24 +09:00
struct_accessor.yml Support tracing of struct member accessor methods 2023-12-07 10:29:33 -08:00
time_at.yml Skip string allocation in benchmark/time_at.yml 2021-11-14 23:25:25 -08:00
time_new.yml Add benchmarks to create Time instances 2021-09-12 18:44:53 +09:00
time_now.yml Speed up and avoid kwarg hash alloc in Time.now 2022-01-12 12:55:14 -08:00
time_parse.yml [Feature #18033] Make Time.new parse time strings 2022-12-16 22:52:59 +09:00
time_strptime.yml Time.strptime benchmarks 2019-01-07 02:05:21 +00:00
time_subsec.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_array.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_attr_ivar.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_attr_ivar_set.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_backtrace.rb Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_bigarray.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_bighash.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_block.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_block_handler.yml add benchmark for different block handlers 2020-06-03 16:13:47 +09:00
vm_blockparam.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_blockparam_call.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_blockparam_pass.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_blockparam_yield.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_call_bmethod.yml Speed up calling iseq bmethods 2023-04-25 08:06:16 -07:00
vm_call_kw_and_kw_splat.yml Fix crash when passing large keyword splat to method accepting keywords and keyword splat 2024-02-11 22:48:38 -08:00
vm_call_method_missing.yml Optimize method_missing calls 2023-04-25 08:06:16 -07:00
vm_call_send_iseq.yml Optimize send calls 2023-04-25 08:06:16 -07:00
vm_call_symproc.yml Optimize symproc calls 2023-04-25 08:06:16 -07:00
vm_case.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_case_classes.yml compile.c: Emit send for === calls in when statements 2021-05-28 12:34:03 -04:00
vm_case_lit.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_clearmethodcache.rb Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_const.yml New constant caching insn: opt_getconstant_path 2022-09-01 15:20:49 -07:00
vm_cvar.yml Add a cache for class variables 2021-06-18 10:02:44 -07:00
vm_defined_method.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_dstr.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_dstr_ary.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_bool.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_class_module.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_digit.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_int.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_nil.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_obj.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_obj_def.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_str.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_dstr_sym.rb Optimize dynamic string interpolation for symbol/true/false/nil/0-9 2021-11-18 15:10:20 -08:00
vm_ensure.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_eval.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_fiber_allocate.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_fiber_count.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_fiber_reuse.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_fiber_reuse_gc.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_fiber_switch.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_float_simple.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_freezeobj.yml Adds a benchmark to measure freezing objects 2022-09-22 10:29:43 -07:00
vm_freezestring.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc.rb Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_old_full.rb Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_old_immediate.rb Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_old_lazy.rb Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_short_lived.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_short_with_complex_long.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_short_with_long.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_short_with_symbol.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_wb_ary.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_wb_ary_promoted.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_wb_obj.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_gc_wb_obj_promoted.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_iclass_super.yml Improve the performance of super 2020-09-23 11:52:36 -07:00
vm_ivar.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_ivar_embedded_obj_init.yml Fixes ivar benchmarks to not depend on object allocation 2022-07-15 10:29:42 -04:00
vm_ivar_extended_obj_init.yml Fixes ivar benchmarks to not depend on object allocation 2022-07-15 10:29:42 -04:00
vm_ivar_generic_get.yml Add benchmarks for setting / getting ivars on generics 2022-07-15 13:39:02 -07:00
vm_ivar_generic_set.yml Add benchmarks for setting / getting ivars on generics 2022-07-15 13:39:02 -07:00
vm_ivar_get.yml Fix style on vm_ivar benchmarks (#6379) 2022-09-15 09:39:39 +09:00
vm_ivar_get_unintialized.yml Fix style on vm_ivar benchmarks (#6379) 2022-09-15 09:39:39 +09:00
vm_ivar_ic_miss.yml Update benchmark/vm_ivar_ic_miss.yml 2023-10-24 10:52:06 -07:00
vm_ivar_lazy_set.yml Fix style on vm_ivar benchmarks (#6379) 2022-09-15 09:39:39 +09:00
vm_ivar_memoize.yml vm_getivar: assume the cached shape_id like have a common ancestor 2023-11-03 12:47:43 +01:00
vm_ivar_of_class.yml allow to access ivars of classes/modules 2021-10-23 01:32:55 +09:00
vm_ivar_of_class_set.yml add vm_ivar_of_class_set 2021-10-23 01:32:55 +09:00
vm_ivar_set.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_ivar_set_on_instance.yml Make benchmark indentation consistent 2022-08-19 14:44:08 -07:00
vm_ivar_set_subclass.yml Fixes ivar benchmarks to not depend on object allocation 2022-07-15 10:29:42 -04:00
vm_length.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_lvar_cond_set.yml avoid extra dup and pop in compile_op_asgn2 2022-09-22 09:47:13 -07:00
vm_lvar_init.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_lvar_set.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_method.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_method_missing.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_method_splat_calls.yml Add benchmark for recent optimization to avoid implicit allocations 2023-12-07 11:27:55 -08:00
vm_method_splat_calls2.yml Avoid allocation when passing no keywords to anonymous kwrest methods 2024-02-13 11:05:26 -05:00
vm_method_with_block.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_module_ann_const_set.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_module_const_set.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_mutex.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_neq.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_newlambda.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_not.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_poly_method.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_poly_method_ov.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_poly_same_method.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_poly_singleton.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_proc.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_raise1.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_raise2.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_regexp.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_rescue.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_send.yml Added benchmark of vm_send by variable [ci skip] 2020-10-28 09:47:46 +09:00
vm_send_cfunc.yml Optimize cfunc calls for f(*a) and f(*a, **kw) if kw is empty 2023-04-25 08:06:16 -07:00
vm_simplereturn.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_string_literal.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_big_aref_hi.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_big_aref_lo.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_big_aset.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_big_href_hi.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_big_href_lo.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_big_hset.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_small_aref.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_small_aset.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_small_href.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_struct_small_hset.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_super.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_super_splat_calls.yml Add benchmarks for super and zsuper calls of different types 2024-03-01 07:10:25 -08:00
vm_swap.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_symbol_block_pass.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_alive_check.yml Improve benchmarks and tests for threads. 2019-06-19 20:39:10 +12:00
vm_thread_close.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_condvar1.rb Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
vm_thread_condvar2.rb Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
vm_thread_create_join.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_mutex1.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_mutex2.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_mutex3.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_pass.rb Fix typo in comment [ci skip] 2019-08-10 09:35:28 +09:00
vm_thread_pass_flood.rb Improve benchmarks and tests for threads. 2019-06-19 20:39:10 +12:00
vm_thread_pipe.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_queue.rb Improve benchmarks and tests for threads. 2019-06-19 20:39:10 +12:00
vm_thread_sized_queue.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_sized_queue2.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_sized_queue3.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_sized_queue4.rb benchmark: drop all bm_ prefix for legacy driver.rb 2018-07-10 13:08:40 +00:00
vm_thread_sleep.yml Improve benchmarks and tests for threads. 2019-06-19 20:39:10 +12:00
vm_unif1.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_yield.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_zsuper.yml Unify vm benchmark prefixes to vm_ (#3028) 2020-04-13 21:37:42 -07:00
vm_zsuper_splat_calls.yml Add benchmarks for super and zsuper calls of different types 2024-03-01 07:10:25 -08:00

README.md

ruby/benchmark

This directory has benchmark definitions to be run with benchmark_driver.gem.

Normal usage

Execute gem install benchmark_driver and run a command like:

# Run a benchmark script with the ruby in the $PATH
benchmark-driver benchmark/app_fib.rb

# Run benchmark scripts with multiple Ruby executables or options
benchmark-driver benchmark/*.rb -e /path/to/ruby -e '/path/to/ruby --jit'

# Or compare Ruby versions managed by rbenv
benchmark-driver benchmark/*.rb --rbenv '2.5.1;2.6.0-preview2 --jit'

# You can collect many metrics in many ways
benchmark-driver benchmark/*.rb --runner memory --output markdown

# Some are defined with YAML for complex setup or accurate measurement
benchmark-driver benchmark/*.yml

See also:

Usage: benchmark-driver [options] RUBY|YAML...
    -r, --runner TYPE                Specify runner type: ips, time, memory, once, block (default: ips)
    -o, --output TYPE                Specify output type: compare, simple, markdown, record, all (default: compare)
    -e, --executables EXECS          Ruby executables (e1::path1 arg1; e2::path2 arg2;...)
        --rbenv VERSIONS             Ruby executables in rbenv (x.x.x arg1;y.y.y arg2;...)
        --repeat-count NUM           Try benchmark NUM times and use the fastest result or the worst memory usage
        --repeat-result TYPE         Yield "best", "average" or "worst" result with --repeat-count (default: best)
        --alternate                  Alternate executables instead of running the same executable in a row with --repeat-count
        --bundler                    Install and use gems specified in Gemfile
        --filter REGEXP              Filter out benchmarks with given regexp
        --run-duration SECONDS       Warmup estimates loop_count to run for this duration (default: 3)
        --timeout SECONDS            Timeout ruby command execution with timeout(1)
    -v, --verbose                    Verbose mode. Multiple -v options increase visilibity (max: 2)

make benchmark

Using make benchmark, make update-benchmark-driver automatically downloads the supported version of benchmark_driver, and it runs benchmarks with the downloaded benchmark_driver.

# Run all benchmarks with the ruby in the $PATH and the built ruby
make benchmark

# Or compare with specific ruby binary
make benchmark COMPARE_RUBY="/path/to/ruby --jit"

# Run vm benchmarks
make benchmark ITEM=vm

# Run some limited benchmarks in ITEM-matched files
make benchmark ITEM=vm OPTS=--filter=block

# You can specify the benchmark by an exact filename instead of using the default argument:
# ARGS = $$(find $(srcdir)/benchmark -maxdepth 1 -name '*$(ITEM)*.yml' -o -name '*$(ITEM)*.rb')
make benchmark ARGS=benchmark/erb_render.yml

# You can specify any option via $OPTS
make benchmark OPTS="--help"

# With `make benchmark`, some special runner plugins are available:
#   -r peak, -r size, -r total, -r utime, -r stime, -r cutime, -r cstime
make benchmark ITEM=vm_bigarray OPTS="-r peak"