Actions
Feature #17498
closedImprove performance some Float methods
Status:
Closed
Assignee:
-
Target version:
-
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
Updated by S_H_ (Shun Hiraoka) about 4 years ago
- Status changed from Open to Closed
Applied in changeset git|daec5f9edcfbf98b10a4bfc1aa501c9ac2c64841.
Improve performance some Float methods [Feature #17498] (#4018)
Actions
Like0
Like0Like0