| Age | Commit message (Collapse) | Author |
|
Invert nil checks to improve performance
|
|
Refactor random char generation
|
|
Fix the following safe offenses:
- Style/OperatorMethodCall
- Style/RandomWithOffset
And use Array.new to avoid an extra allocation:
```
Comparison (IPS):
Array.new(8) { rand(65..89).chr }.join: 492433.7 i/s
(0...8).map { 65.+(rand(25)).chr }.join: 432155.8 i/s - 1.14x (± 0.00) slower
Comparison (Memory):
Array.new(8) { rand(65..89).chr }.join: 440 allocated
(0...8).map { 65.+(rand(25)).chr }.join: 560 allocated - 1.27x more
```
|
|
Check for `nil` before checking for more expensive conditions which
include a method call or an array scan.
Also removes redundant comments on self-explanatory code
|
|
Fix format string offenses
|
|
This commit fixes cases that cannot be detected by RuboCop
Ref: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
|
|
`%` is an operation on `String` that will return a new `String`, so
the interpolation is redundant
Also adds a missing spec on PivotTable#rels_pn
```
IPS:
uninterpolated: 4045715.7 i/s
interpolated: 2359775.6 i/s - 1.71x (± 0.00) slower
Memory:
uninterpolated: 160 allocated
interpolated: 232 allocated - 1.45x more
```
|
|
`Kernel#format` is faster and will avoid to allocate an array compared
to `String#%`.
```
IPS:
kernel_format: 3877614.2 i/s
string_percent: 3531475.0 i/s - 1.10x (± 0.00) slower
Memory:
kernel_format: 160 allocated
string_percent: 200 allocated - 1.25x more
```
|
|
Avoid unnecessary calls to `parse_options`
|
|
Fix negated if offenses
|
|
Remove redundant parentheses
|
|
`Cell#initialize` is one of the most used methods in the library, so
a small improvement here will make a lot of difference on the overall
performance.
The impact of this change is negligible when `options` has elements
but is substantial when it is empty.
```
Comparison (empty options):
parse unless: 11636650.6 i/s
parse: 8109825.4 i/s - 1.43x (± 0.00) slower
Comparison (1 option):
parse: 3548037.5 i/s
parse unless: 3459029.7 i/s - same-ish: difference falls within error
```
|
|
Should also provide a negligible performance improvement, about 3%
on Ruby 3.2 and 6% on Ruby 2.6 (M1 Pro)
|
|
- Style/ParenthesesAroundCondition
- Style/RedundantParentheses
- Style/TernaryParentheses
`Style/ParenthesesAroundCondition` may be questionable, but a majority
of comparison where not using parentheses, so offenses have been fixed
for uniformity across the codebase
|
|
Use Ruby 1.9 hash syntax
|
|
|
|
Fix Style/SymbolProc offenses
|
|
Fix Style/MutableConstant offenses
|
|
Fix Style/YodaCondition offense
|
|
Fix Style/ConditionalAssignment offenses
|
|
This also provides a performance improvement
```
Comparison (array of 4 elements):
map(&): 3643131.4 i/s
map {}: 3488052.5 i/s - 1.04x (± 0.00) slower
Comparison (array of 20 elements):
map(&): 466013.9 i/s
map {}: 408447.2 i/s - 1.14x (± 0.00) slower
```
|
|
|
|
|
|
|
|
Fix Style/HashEachMethods offense
|
|
Fix string concatenation in production code
|
|
|
|
Improve absolute cell reference method
|
|
Fix Style/IfInsideElse offense
|
|
tagliala/chore/fix-string-concatenation-in-non-production-code
Fix StringConcatenation offenses (non-production)
|
|
tagliala/chore/fix-redundant-file-extension-in-require-offenses
Fix Style/RedundantFileExtensionInRequire offenses
|
|
Enable Naming cops
|
|
Use #== and #eql? from BasicObject
|
|
Remove duplicate branch condition
|
|
Also inverts `string.match(REGEX)` with `REGEX.match(string)` because
of uniformity and because it has been tested 5% more performant on
Ruby 3.2. Performance on older Rubies is the same
```
REGEX.match(string): 1234330.7 i/s
string.match(REGEX): 1172670.1 i/s - 1.05x (± 0.00) slower
```
|
|
Replace `keys.each` with hash iteration
```rb
MY_HASH = {
first: '1',
second: '2',
third: '3'
}
%i[ips memory].each do |benchmark|
Benchmark.send(benchmark) do |x|
x.report("each_key") { MY_HASH.each_key { |k| MY_HASH[k] } }
x.report("keys.each") { MY_HASH.keys.each { |k| MY_HASH[k] } }
x.report("each") { MY_HASH.each { |k, v| v } }
x.compare!
end
end
```
```
IPS Comparison:
each: 4283031.6 i/s
each_key: 3683407.4 i/s - 1.16x (± 0.00) slower
keys.each: 3387425.1 i/s - 1.26x (± 0.00) slower
Memory Comparison:
each_key: 0 allocated
each: 0 allocated - same
keys.each: 40 allocated - Infx more
```
|
|
Also fix safe minor offenses
- Naming/BinaryOperatorParameterName
- Naming/HeredocDelimiterCase
|
|
Prefer interpolation over concatenation
```
Comparison ("String#{'String'}" vs 'String' + 'String'):
interpolation: 11821321.0 i/s
concatenation: 8849491.7 i/s - 1.34x (± 0.00) slower
```
|
|
Make the gem more secure by requiring that all privileged operations by
any of the owners require OTP.
Ref: https://guides.rubygems.org/mfa-requirement-opt-in/
|
|
Axlsx::Row is now an Array, so it is possible to remove the extra
duplicate branch
|
|
Enable Gemspec cops
|
|
Do not use collection literal in loops
|
|
Fix axlsx_styler gem deprecation error
|
|
|
|
|
|
|
|
Also refactors Page margins to avoid code duplication
|
|
Gemspec/RequireMFA will be fixed via #197
|
|
Improve cell type from value implementation
|
|
Fix profiler deprecations
|