Feature #17498
Updated by S_H_ (Shun Hiraoka) over 3 years ago
Improve performance some Float methods(write in Ruby)
benchmark:
```yml
prelude: |
flo = 4.2
benchmark:
to_f: |
flo.to_f
abs: |
flo.abs
magnitude: |
flo.magnitude
-@: |
-flo
zero?: |
flo.zero?
loop_count: 20000000
```
result:
```bash
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