Project

General

Profile

Actions

Feature #17054

closed

Some NilClass methods are faster if implemented in Ruby

Added by S_H_ (Shun Hiraoka) over 4 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:50937]

Description

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

So I tried implementing some NilClass methods in Ruby:

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 known_errors.inc
known_errors.inc unchanged
generating vm_call_iseq_optimized.inc
vm_call_iseq_optimized.inc 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|

Updated by marcandre (Marc-Andre Lafortune) over 4 years ago

  • Status changed from Open to Rejected

Updated by marcandre (Marc-Andre Lafortune) over 4 years ago

  • Status changed from Rejected to Open

Sorry, looks like I misread.

Actions #4

Updated by sawa (Tsuyoshi Sawada) over 4 years ago

  • Subject changed from Implemented some NilClass method in Ruby code is faster to Some NilClass methods are faster if implemented in Ruby
  • Description updated (diff)
Actions #5

Updated by S_H_ (Shun Hiraoka) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|28b481938b5c8211aad53ba82fe4ddd978ffc00f.


Implemented some NilClass method in Ruby code is faster [Feature #17054] (#3366)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0