Skip to content

Improve performance Float#positive? and Float#negative? [Feature #17614]#4160

Merged
k0kubun merged 1 commit intoruby:masterfrom
S-H-GAMELINKS:improve_float_method
Feb 9, 2021
Merged

Improve performance Float#positive? and Float#negative? [Feature #17614]#4160
k0kubun merged 1 commit intoruby:masterfrom
S-H-GAMELINKS:improve_float_method

Conversation

@S-H-GAMELINKS
Copy link
Contributor

Improve performance Float#negative? and Float#positive?(write in Ruby)

benchmark:

prelude: |
  flo = 4.2
benchmark:
  negative?: |
    flo.negative?
  positive?: |
    flo.positive?
loop_count: 20000000

result:

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-08T12:46:07Z master 4186cd6435) [x86_64-linux]
built-ruby: ruby 3.1.0dev (2021-02-08T13:12:22Z improve_float_method 0dbc6d3f5f) [x86_64-linux]
# Iteration per second (i/s)

|           |compare-ruby|built-ruby|
|:----------|-----------:|---------:|
|negative?  |     80.954M|   94.642M|
|           |           -|     1.17x|
|positive?  |     79.471M|   95.963M|
|           |           -|     1.21x|

ticket: Feature #17614 Improve performance Float#negative? and Float#positive?

@k0kubun k0kubun merged commit fad7908 into ruby:master Feb 9, 2021
@S-H-GAMELINKS S-H-GAMELINKS deleted the improve_float_method branch February 9, 2021 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants