From: "ko1 (Koichi Sasada)" Date: 2021-12-02T18:31:17+00:00 Subject: [ruby-core:106406] [Ruby master Feature#17670] Improve performance Float#to_i Issue #17670 has been updated by ko1 (Koichi Sasada). Status changed from Open to Closed closed on GH PR ---------------------------------------- Feature #17670: Improve performance Float#to_i https://bugs.ruby-lang.org/issues/17670#change-95045 * Author: S_H_ (Shun Hiraoka) * Status: Closed * Priority: Normal ---------------------------------------- Improve performance `Float#to_i` and `Float#to_int` methods(write in Ruby) benchmark: ```yml prelude: | flo = 4.2 benchmark: to_i: | flo.to_i to_int: | flo.to_int loop_count: 20000000 ``` result: ```bash sh@DESKTOP-L0NI312:~/rubydev/build$ make benchmark/benchmark.yml -e COMPARE_RUBY=~/.rbenv/shims/ruby -e BENCH_RUBY=../install/bin/ruby generating vm_call_iseq_optimized.inc vm_call_iseq_optimized.inc unchanged compare-ruby: ruby 3.1.0dev (2021-02-28T11:24:42Z master 80e2c45f55) [x86_64-linux] built-ruby: ruby 3.1.0dev (2021-02-28T11:24:42Z improve_float_to_i 80e2c45f55) [x86_64-linux] # Iteration per second (i/s) | |compare-ruby|built-ruby| |:-------|-----------:|---------:| |to_i | 69.184M| 78.294M| | | -| 1.13x| |to_int | 69.891M| 80.285M| | | -| 1.15x| ``` `COMPARE_RUBY` is `ruby 3.1.0dev (2021-02-28T11:24:42Z master 80e2c45f55) [x86_64-linux]`. `BENCH_RUBY` is ahead of `ruby 3.1.0dev (2021-02-28T11:24:42Z master 80e2c45f55) [x86_64-linux]`. pull request: https://github.com/ruby/ruby/pull/4234 -- https://bugs.ruby-lang.org/ Unsubscribe: