Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure Style/NumericPredicate for performance
Replace predicate methods like `v.zero?` with direct comparison `v == 0` for better performance. While the current implementation may not show visible improvements, frequently called methods using `.zero?` instead of `== 0` can lead to significant performance losses. Benchmarks across Ruby versions 2.5 to 3.3 consistently show comparisons outperforming predicates: ``` Comparison (Ruby 2.6 to 3.2, v = 0): v == 0: 21479329.3 i/s v.zero?: 17979885.4 i/s - 1.19x (± 0.00) slower Comparison (Ruby 2.5 and 3.3, v = 0): v == 0: 23652215.7 i/s v.zero?: 21843174.0 i/s - 1.08x (± 0.00) slower Comparison (Ruby 2.5 to 3.3, v = 1): v == 0: 23227474.2 i/s v.zero?: 21675200.9 i/s - 1.07x (± 0.00) slower ```
- Loading branch information