Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Replace positive? with 'greater than 0' (#1586)
Opentelemtry used in many projects and micro performance could impact a lot. The default rubocop style was not designed in performance overview. [subjective] Benchmarks shows the `Numeric#positive?` is 1.32x slower, than 'number > 0'. ``` ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [arm64-darwin23] Warming up -------------------------------------- compare with 0 1.000 i/100ms positive? 1.000 i/100ms Calculating ------------------------------------- compare with 0 3.153 (± 0.0%) i/s - 95.000 in 30.132600s positive? 2.397 (± 0.0%) i/s - 72.000 in 30.042688s Comparison: compare with 0: 3.2 i/s positive?: 2.4 i/s - 1.32x slower ``` The change disables Style/NumericPredicate for rubocop as well. Signed-off-by: Michael Nikitochkin <[email protected]> Co-authored-by: Kayla Reopelle (she/her) <[email protected]> Co-authored-by: Robert <[email protected]>
- Loading branch information