Project

General

Profile

Actions

Feature #17498

closed

Improve performance some Float methods

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

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:101846]

Description

Improve performance some Float methods(write in Ruby)

benchmark:

prelude: |
  flo = 4.2
benchmark:
  to_f: |
    flo.to_f
  abs: |
    flo.abs
  magnitude: |
    flo.magnitude
  -@: |
    -flo
  zero?: |
    flo.zero?
loop_count: 20000000


result:

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

|           |compare-ruby|built-ruby|
|:----------|-----------:|---------:|
|to_f       |     60.880M|   81.272M|
|           |           -|     1.33x|
|abs        |     68.162M|   81.264M|
|           |           -|     1.19x|
|magnitude  |     53.441M|   78.829M|
|           |           -|     1.48x|
|-@         |     67.193M|   84.731M|
|           |           -|     1.26x|
|zero?      |     69.894M|   82.032M|
|           |           -|     1.17x|

COMPARE_RUBY is ruby 3.1.0dev (2020-12-31T22:55:59Z master 3d7f71801a) [x86_64-linux]. BENCH_RUBY is ahead of ruby 3.1.0dev (2020-12-31T22:55:59Z master 3d7f71801a) [x86_64-linux].

pull requests:
https://github.com/ruby/ruby/pull/4018

Actions #1

Updated by S_H_ (Shun Hiraoka) over 3 years ago

  • Description updated (diff)
Actions #2

Updated by S_H_ (Shun Hiraoka) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset git|daec5f9edcfbf98b10a4bfc1aa501c9ac2c64841.


Improve performance some Float methods [Feature #17498] (#4018)

Actions

Also available in: Atom PDF

Like0
Like0Like0