Feature #17054

Updated by sawa (Tsuyoshi Sawada) about 2 months ago

Looking at these pull requests, I wondered think, "Is it faster to implement some NilClass methods in Ruby?" method by Ruby code?". 


 So I tried implementing some NilClass methods in Ruby: by Ruby. 

 * benchmark: 

 The following is benchmark, where `COMPARE_RUBY` is ruby 2.8.0dev (2020-07-27T15:18:40Z master c5ae79d7e9) [x86_64-linux] and `BENCH_RUBY` is ahead of ruby 2.8.0dev (2020-07-27T15:18:40Z master c5ae79d7e9) [x86_64-linux]: 

 sh@MyComputer:~/rubydev/build$ make benchmark/benchmark.yml -e COMPARE_RUBY=~/.rbenv/shims/ruby -e BENCH_RUBY=../install/bin/ruby 
 generating unchanged 
 generating unchanged 
 # Iteration per second (i/s) 

 |        |compare-ruby|built-ruby| 
 |to_i    |       36.563M|     60.801M| 
 |        |             -|       1.66x| 
 |to_f    |       66.225M|     70.205M| 
 |        |             -|       1.06x| 

 `COMPARE_RUBY` is `ruby 2.8.0dev (2020-07-27T15:18:40Z master c5ae79d7e9) [x86_64-linux]`. `BENCH_RUBY` is ahead of `ruby 2.8.0dev (2020-07-27T15:18:40Z master c5ae79d7e9) [x86_64-linux]`