Project

General

Profile

Actions

Feature #17135

closed

Improve performance of Integer#size method

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

Status:
Closed
Target version:
-
[ruby-core:99779]

Description

Integer#size seems to show improved performance when written in ruby.

benchmark:

prelude: |
  n = 42
benchmark:
  size: |
    n.size
loop_count: 20000000

result:

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

|      |compare-ruby|built-ruby|
|:-----|-----------:|---------:|
|size  |     65.749M|   87.117M|
|      |           -|     1.33x|

COMPARE_RUBY is ruby 2.8.0dev (2020-08-28T10:47:29Z master 7e1fddba4a) [x86_64-linux]. BENCH_RUBY is patched.

pull request:
https://github.com/ruby/ruby/pull/3476

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0