radius-spec 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.travis.yml +2 -5
- data/CHANGELOG.md +18 -0
- data/Gemfile +1 -0
- data/benchmarks/call_vs_yield.rb +33 -0
- data/benchmarks/casecmp_vs_downcase.rb +488 -0
- data/bin/ci +1 -1
- data/common_rubocop.yml +41 -0
- data/common_rubocop_rails.yml +7 -9
- data/lib/radius/spec/version.rb +1 -1
- data/radius-spec.gemspec +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6155ce5b3b86485b3a2011fbf15cd2ad268e0f74639986260057d1fcfccdff8
|
4
|
+
data.tar.gz: 0556fe666ef3b4522f32e5f1edaa004ef344bc7a7f47283cc7b49656d3c04950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc10a35535a2b7b39e2ae261fa98d45fbc87c6579366861935c04cc5d15d317182b00c0daaf1414ef457f3e26952fde8cf7b728db924c9befea0c9fd8238d1a
|
7
|
+
data.tar.gz: 176adf989c35360f4e137da3757aeda641414fe29ee50800c69c3d2091342451375e03ed8db3987a3cee5f6d7841ec58da71e8bee4d67854f5a4e043527f7477
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,17 +1,14 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
3
2
|
cache: bundler
|
4
|
-
before_install:
|
5
|
-
- gem update --system
|
6
|
-
- gem install bundler
|
7
3
|
bundler_args: --jobs=3 --retry=3 --without documentation debug
|
8
4
|
before_script:
|
9
5
|
- "bin/ci-code-review"
|
10
6
|
script: bin/ci
|
11
7
|
rvm:
|
8
|
+
- 2.6
|
12
9
|
- 2.5
|
13
10
|
- ruby-head
|
14
|
-
|
11
|
+
jobs:
|
15
12
|
allow_failures:
|
16
13
|
- rvm: ruby-head
|
17
14
|
fast_finish: true
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## 0.6.0 (August 6, 2020)
|
2
|
+
|
3
|
+
[Full Changelog](https://github.com/RadiusNetworks/radius-spec/compare/v0.5.0...v0.6.0)
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
- Exclude more bundler binstubs from Rubocop (Aaron Kromer, #18, #20)
|
8
|
+
- Exclude `chdir` and `Capybara.register_driver` configuration blocks from
|
9
|
+
`Metrics/BlockLength` checks (Aaron Kromer, #18)
|
10
|
+
- Exclude gem specs from block and line length metrics (Aaron Kromer, #20)
|
11
|
+
- Standardize on key style of `Layout/AlignHash` (Aaron Kromer, #18)
|
12
|
+
- Upgrade to Rubocop 0.62.x (Aaron Kromer, #21)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
None
|
17
|
+
|
18
|
+
|
1
19
|
## 0.5.0 (September 26, 2018)
|
2
20
|
|
3
21
|
[Full Changelog](https://github.com/RadiusNetworks/radius-spec/compare/v0.4.0...v0.5.0)
|
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
8
8
|
gemspec
|
9
9
|
|
10
10
|
group :benchmark, optional: true do
|
11
|
+
gem 'activesupport', require: false
|
11
12
|
gem 'benchmark-ips', require: false
|
12
13
|
# TODO: See if this gem has an update in the future as it's gemspec is too
|
13
14
|
# strict and it was blocking other gems from installing / updating
|
data/benchmarks/call_vs_yield.rb
CHANGED
@@ -146,3 +146,36 @@ Comparison:
|
|
146
146
|
block.call: 3557929.5 i/s - 5.12x (± 0.14) slower
|
147
147
|
with 95.0% confidence
|
148
148
|
```
|
149
|
+
|
150
|
+
### Environment
|
151
|
+
|
152
|
+
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin16]
|
153
|
+
GC Disabled: false
|
154
|
+
|
155
|
+
### Test Cases
|
156
|
+
|
157
|
+
#### Block call vs yield
|
158
|
+
|
159
|
+
```
|
160
|
+
Warming up --------------------------------------
|
161
|
+
block.call 252.830k i/100ms
|
162
|
+
block yield 266.647k i/100ms
|
163
|
+
block arg only 275.856k i/100ms
|
164
|
+
no arg yield 271.677k i/100ms
|
165
|
+
pass through block 251.117k i/100ms
|
166
|
+
Calculating -------------------------------------
|
167
|
+
block.call 11.729M (± 0.9%) i/s - 58.404M in 5.004905s
|
168
|
+
block yield 13.216M (± 0.8%) i/s - 65.862M in 5.007922s
|
169
|
+
block arg only 17.288M (± 0.9%) i/s - 86.067M in 5.009110s
|
170
|
+
no arg yield 16.109M (± 0.9%) i/s - 80.145M in 5.006225s
|
171
|
+
pass through block 10.175M (± 1.0%) i/s - 50.726M in 5.010616s
|
172
|
+
with 95.0% confidence
|
173
|
+
|
174
|
+
Comparison:
|
175
|
+
block arg only: 17287836.2 i/s
|
176
|
+
no arg yield: 16108506.9 i/s - 1.07x (± 0.01) slower
|
177
|
+
block yield: 13215609.2 i/s - 1.31x (± 0.02) slower
|
178
|
+
block.call: 11729199.4 i/s - 1.47x (± 0.02) slower
|
179
|
+
pass through block: 10174648.1 i/s - 1.70x (± 0.02) slower
|
180
|
+
with 95.0% confidence
|
181
|
+
```
|
@@ -0,0 +1,488 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Run from the command line: bundle exec ruby benchmarks/casecmp_vs_downcase.rb
|
4
|
+
require_relative 'bm_setup'
|
5
|
+
|
6
|
+
display_benchmark_header
|
7
|
+
|
8
|
+
EXPECTED = "match"
|
9
|
+
|
10
|
+
puts "### Base Cases"
|
11
|
+
|
12
|
+
def downcase_eql(test_case)
|
13
|
+
EXPECTED == test_case.downcase
|
14
|
+
end
|
15
|
+
|
16
|
+
def casecmp_eql(test_case)
|
17
|
+
0 == EXPECTED.casecmp(test_case)
|
18
|
+
end
|
19
|
+
|
20
|
+
def casecmp_zero(test_case)
|
21
|
+
EXPECTED.casecmp(test_case).zero?
|
22
|
+
end
|
23
|
+
|
24
|
+
# This is similar to the original Rubocop cited benchmark code.
|
25
|
+
["No MaTcH", "MaTcH"].each do |test_case|
|
26
|
+
section "Case: #{test_case.downcase}" do |bench|
|
27
|
+
bench.report("== downcase") do
|
28
|
+
downcase_eql(test_case)
|
29
|
+
end
|
30
|
+
|
31
|
+
bench.report("== casecmp") do
|
32
|
+
casecmp_eql(test_case)
|
33
|
+
end
|
34
|
+
|
35
|
+
bench.report("casecmp.zero?") do
|
36
|
+
casecmp_zero(test_case)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# As of Ruby 2.5 both `casecmp` and `casecmp?` accept any object. In the cases
|
42
|
+
# where the object is not a string they return `nil`. Prior Ruby 2.5 string
|
43
|
+
# conversions need to occur before the compare.
|
44
|
+
puts "### Type Cases"
|
45
|
+
|
46
|
+
def tos_downcase_eql(test_case)
|
47
|
+
EXPECTED == test_case.to_s.downcase
|
48
|
+
end
|
49
|
+
|
50
|
+
def safe_casecmp_zero(test_case)
|
51
|
+
EXPECTED.casecmp(test_case)&.zero?
|
52
|
+
end
|
53
|
+
|
54
|
+
def casecmp_to_i_zero(test_case)
|
55
|
+
EXPECTED.casecmp(test_case).to_i.zero?
|
56
|
+
end
|
57
|
+
|
58
|
+
def casecmp?(test_case)
|
59
|
+
EXPECTED.casecmp?(test_case)
|
60
|
+
end
|
61
|
+
|
62
|
+
class StringLike
|
63
|
+
def initialize(test_case)
|
64
|
+
@test_case = test_case
|
65
|
+
end
|
66
|
+
|
67
|
+
def to_str
|
68
|
+
@test_case
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
[
|
73
|
+
nil,
|
74
|
+
"no match",
|
75
|
+
"match",
|
76
|
+
123,
|
77
|
+
Object.new,
|
78
|
+
StringLike.new("no match"),
|
79
|
+
StringLike.new("match"),
|
80
|
+
].each do |test_case|
|
81
|
+
section "Type Case: #{test_case.inspect}" do |bench|
|
82
|
+
bench.report("== to_s.downcase") do
|
83
|
+
tos_downcase_eql(test_case)
|
84
|
+
end
|
85
|
+
|
86
|
+
bench.report("== casecmp") do
|
87
|
+
casecmp_eql(test_case)
|
88
|
+
end
|
89
|
+
|
90
|
+
bench.report("casecmp.zero?") do
|
91
|
+
safe_casecmp_zero(test_case)
|
92
|
+
end
|
93
|
+
|
94
|
+
bench.report("casecmp.to_i.zero?") do
|
95
|
+
casecmp_to_i_zero(test_case)
|
96
|
+
end
|
97
|
+
|
98
|
+
bench.report("casecmp?") do
|
99
|
+
casecmp?(test_case)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def pre_casecmp_eql(test_case)
|
105
|
+
test_case && 0 == EXPECTED.casecmp(test_case)
|
106
|
+
end
|
107
|
+
|
108
|
+
def pre_casecmp_zero(test_case)
|
109
|
+
test_case && EXPECTED.casecmp(test_case).zero?
|
110
|
+
end
|
111
|
+
|
112
|
+
def pre_bang_casecmp_eql(test_case)
|
113
|
+
!!test_case && 0 == EXPECTED.casecmp(test_case)
|
114
|
+
end
|
115
|
+
|
116
|
+
def pre_bang_casecmp_zero(test_case)
|
117
|
+
!!test_case && EXPECTED.casecmp(test_case).zero?
|
118
|
+
end
|
119
|
+
|
120
|
+
def pre_nil_casecmp_eql(test_case)
|
121
|
+
!test_case.nil? && 0 == EXPECTED.casecmp(test_case)
|
122
|
+
end
|
123
|
+
|
124
|
+
def pre_nil_casecmp_zero(test_case)
|
125
|
+
!test_case.nil? && EXPECTED.casecmp(test_case).zero?
|
126
|
+
end
|
127
|
+
|
128
|
+
# Given the results below this is another set of tests to try to determine if
|
129
|
+
# knowing you'll either have `nil` or a `String`
|
130
|
+
[nil, "no match"].each do |test_case|
|
131
|
+
section "Pre-check Case: #{test_case.inspect}" do |bench|
|
132
|
+
bench.report("== casecmp(to_s)") do
|
133
|
+
casecmp_eql(test_case.to_s)
|
134
|
+
end
|
135
|
+
|
136
|
+
if RUBY_VERSION.to_f > 2.3
|
137
|
+
bench.report("casecmp?(to_s)") do
|
138
|
+
casecmp?(test_case.to_s)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
if RUBY_VERSION.to_f > 2.4
|
143
|
+
bench.report("casecmp?") do
|
144
|
+
casecmp?(test_case)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
bench.report("falsey casecmp.zero?") do
|
149
|
+
pre_casecmp_zero(test_case)
|
150
|
+
end
|
151
|
+
|
152
|
+
bench.report("falsey == casecmp") do
|
153
|
+
pre_casecmp_eql(test_case)
|
154
|
+
end
|
155
|
+
|
156
|
+
bench.report("!! casecmp.zero?") do
|
157
|
+
pre_bang_casecmp_zero(test_case)
|
158
|
+
end
|
159
|
+
|
160
|
+
bench.report("!! == casecmp") do
|
161
|
+
pre_bang_casecmp_eql(test_case)
|
162
|
+
end
|
163
|
+
|
164
|
+
bench.report("nil? casecmp.zero?") do
|
165
|
+
pre_nil_casecmp_zero(test_case)
|
166
|
+
end
|
167
|
+
|
168
|
+
bench.report("nil? == casecmp") do
|
169
|
+
pre_nil_casecmp_eql(test_case)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
__END__
|
175
|
+
|
176
|
+
These results were a little surprising. With `casecmp?` being implemented in C
|
177
|
+
I fully expected that to be the fastest version. As the results below show, it
|
178
|
+
was actually the slowest except for the `nil` case. Given both `casecmp` and
|
179
|
+
`casecmp?` need to perform the same type coercions in Ruby 2.5 this is still
|
180
|
+
a bit of a mystery to me.
|
181
|
+
|
182
|
+
### Environment
|
183
|
+
|
184
|
+
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]
|
185
|
+
GC Disabled: false
|
186
|
+
|
187
|
+
### Test Cases
|
188
|
+
|
189
|
+
### Base Cases
|
190
|
+
|
191
|
+
#### Case: no match
|
192
|
+
|
193
|
+
```
|
194
|
+
Warming up --------------------------------------
|
195
|
+
== downcase 212.956k i/100ms
|
196
|
+
== casecmp 242.441k i/100ms
|
197
|
+
casecmp.zero? 250.362k i/100ms
|
198
|
+
Calculating -------------------------------------
|
199
|
+
== downcase 5.758M (± 1.1%) i/s - 28.749M in 5.013717s
|
200
|
+
== casecmp 7.263M (± 0.8%) i/s - 36.366M in 5.018952s
|
201
|
+
casecmp.zero? 6.641M (± 0.9%) i/s - 33.298M in 5.026902s
|
202
|
+
with 95.0% confidence
|
203
|
+
|
204
|
+
Comparison:
|
205
|
+
== casecmp: 7262964.1 i/s
|
206
|
+
casecmp.zero?: 6640838.5 i/s - 1.09x (± 0.01) slower
|
207
|
+
== downcase: 5757879.1 i/s - 1.26x (± 0.02) slower
|
208
|
+
with 95.0% confidence
|
209
|
+
```
|
210
|
+
|
211
|
+
#### Case: match
|
212
|
+
|
213
|
+
```
|
214
|
+
Warming up --------------------------------------
|
215
|
+
== downcase 223.277k i/100ms
|
216
|
+
== casecmp 255.309k i/100ms
|
217
|
+
casecmp.zero? 244.326k i/100ms
|
218
|
+
Calculating -------------------------------------
|
219
|
+
== downcase 5.601M (± 0.7%) i/s - 28.133M in 5.031201s
|
220
|
+
== casecmp 7.069M (± 0.9%) i/s - 35.488M in 5.033449s
|
221
|
+
casecmp.zero? 6.514M (± 1.0%) i/s - 32.495M in 5.007338s
|
222
|
+
with 95.0% confidence
|
223
|
+
|
224
|
+
Comparison:
|
225
|
+
== casecmp: 7069433.4 i/s
|
226
|
+
casecmp.zero?: 6513865.5 i/s - 1.09x (± 0.01) slower
|
227
|
+
== downcase: 5600607.7 i/s - 1.26x (± 0.01) slower
|
228
|
+
with 95.0% confidence
|
229
|
+
```
|
230
|
+
### Type Cases
|
231
|
+
|
232
|
+
#### Type Case: nil
|
233
|
+
|
234
|
+
```
|
235
|
+
Warming up --------------------------------------
|
236
|
+
== to_s.downcase 206.757k i/100ms
|
237
|
+
== casecmp 165.652k i/100ms
|
238
|
+
casecmp.zero? 243.968k i/100ms
|
239
|
+
casecmp.to_i.zero? 228.771k i/100ms
|
240
|
+
casecmp? 245.631k i/100ms
|
241
|
+
Calculating -------------------------------------
|
242
|
+
== to_s.downcase 4.457M (± 1.3%) i/s - 22.330M in 5.036046s
|
243
|
+
== casecmp 2.959M (± 0.9%) i/s - 14.909M in 5.048155s
|
244
|
+
casecmp.zero? 6.571M (± 0.8%) i/s - 32.936M in 5.023643s
|
245
|
+
casecmp.to_i.zero? 5.610M (± 1.0%) i/s - 28.139M in 5.030920s
|
246
|
+
casecmp? 6.426M (± 0.9%) i/s - 32.178M in 5.022549s
|
247
|
+
with 95.0% confidence
|
248
|
+
|
249
|
+
Comparison:
|
250
|
+
casecmp.zero?: 6570981.1 i/s
|
251
|
+
casecmp?: 6426432.5 i/s - 1.02x (± 0.01) slower
|
252
|
+
casecmp.to_i.zero?: 5609983.7 i/s - 1.17x (± 0.02) slower
|
253
|
+
== to_s.downcase: 4457210.7 i/s - 1.47x (± 0.02) slower
|
254
|
+
== casecmp: 2959310.9 i/s - 2.22x (± 0.03) slower
|
255
|
+
with 95.0% confidence
|
256
|
+
```
|
257
|
+
|
258
|
+
#### Type Case: "no match"
|
259
|
+
|
260
|
+
```
|
261
|
+
Warming up --------------------------------------
|
262
|
+
== to_s.downcase 224.166k i/100ms
|
263
|
+
== casecmp 255.225k i/100ms
|
264
|
+
casecmp.zero? 244.858k i/100ms
|
265
|
+
casecmp.to_i.zero? 239.323k i/100ms
|
266
|
+
casecmp? 184.603k i/100ms
|
267
|
+
Calculating -------------------------------------
|
268
|
+
== to_s.downcase 4.986M (± 1.7%) i/s - 24.882M in 5.041514s
|
269
|
+
== casecmp 7.478M (± 0.9%) i/s - 37.518M in 5.033271s
|
270
|
+
casecmp.zero? 6.879M (± 1.0%) i/s - 34.525M in 5.036217s
|
271
|
+
casecmp.to_i.zero? 6.166M (± 0.9%) i/s - 30.873M in 5.021792s
|
272
|
+
casecmp? 4.520M (± 1.5%) i/s - 22.522M in 5.022920s
|
273
|
+
with 95.0% confidence
|
274
|
+
|
275
|
+
Comparison:
|
276
|
+
== casecmp: 7478045.4 i/s
|
277
|
+
casecmp.zero?: 6878660.6 i/s - 1.09x (± 0.01) slower
|
278
|
+
casecmp.to_i.zero?: 6166061.6 i/s - 1.21x (± 0.02) slower
|
279
|
+
== to_s.downcase: 4985671.0 i/s - 1.50x (± 0.03) slower
|
280
|
+
casecmp?: 4520190.0 i/s - 1.65x (± 0.03) slower
|
281
|
+
with 95.0% confidence
|
282
|
+
```
|
283
|
+
|
284
|
+
#### Type Case: "match"
|
285
|
+
|
286
|
+
```
|
287
|
+
Warming up --------------------------------------
|
288
|
+
== to_s.downcase 222.165k i/100ms
|
289
|
+
== casecmp 255.637k i/100ms
|
290
|
+
casecmp.zero? 242.725k i/100ms
|
291
|
+
casecmp.to_i.zero? 234.070k i/100ms
|
292
|
+
casecmp? 196.526k i/100ms
|
293
|
+
Calculating -------------------------------------
|
294
|
+
== to_s.downcase 5.061M (± 1.1%) i/s - 25.327M in 5.022350s
|
295
|
+
== casecmp 7.213M (± 0.8%) i/s - 36.045M in 5.009733s
|
296
|
+
casecmp.zero? 6.591M (± 0.9%) i/s - 33.011M in 5.021453s
|
297
|
+
casecmp.to_i.zero? 5.916M (± 0.9%) i/s - 29.727M in 5.039360s
|
298
|
+
casecmp? 4.462M (± 1.2%) i/s - 22.404M in 5.041505s
|
299
|
+
with 95.0% confidence
|
300
|
+
|
301
|
+
Comparison:
|
302
|
+
== casecmp: 7212692.8 i/s
|
303
|
+
casecmp.zero?: 6590791.5 i/s - 1.09x (± 0.01) slower
|
304
|
+
casecmp.to_i.zero?: 5915576.8 i/s - 1.22x (± 0.02) slower
|
305
|
+
== to_s.downcase: 5060645.9 i/s - 1.43x (± 0.02) slower
|
306
|
+
casecmp?: 4462174.0 i/s - 1.62x (± 0.02) slower
|
307
|
+
with 95.0% confidence
|
308
|
+
```
|
309
|
+
|
310
|
+
#### Type Case: 123
|
311
|
+
|
312
|
+
```
|
313
|
+
Warming up --------------------------------------
|
314
|
+
== to_s.downcase 194.578k i/100ms
|
315
|
+
== casecmp 162.422k i/100ms
|
316
|
+
casecmp.zero? 241.653k i/100ms
|
317
|
+
casecmp.to_i.zero? 225.119k i/100ms
|
318
|
+
casecmp? 240.602k i/100ms
|
319
|
+
Calculating -------------------------------------
|
320
|
+
== to_s.downcase 4.099M (± 1.0%) i/s - 20.625M in 5.045741s
|
321
|
+
== casecmp 3.068M (± 1.1%) i/s - 15.430M in 5.044417s
|
322
|
+
casecmp.zero? 6.334M (± 0.8%) i/s - 31.657M in 5.007791s
|
323
|
+
casecmp.to_i.zero? 5.284M (± 1.6%) i/s - 26.339M in 5.031971s
|
324
|
+
casecmp? 6.478M (± 1.0%) i/s - 32.481M in 5.031290s
|
325
|
+
with 95.0% confidence
|
326
|
+
|
327
|
+
Comparison:
|
328
|
+
casecmp?: 6478253.4 i/s
|
329
|
+
casecmp.zero?: 6333577.2 i/s - 1.02x (± 0.01) slower
|
330
|
+
casecmp.to_i.zero?: 5284198.7 i/s - 1.23x (± 0.02) slower
|
331
|
+
== to_s.downcase: 4098628.0 i/s - 1.58x (± 0.02) slower
|
332
|
+
== casecmp: 3067817.5 i/s - 2.11x (± 0.03) slower
|
333
|
+
with 95.0% confidence
|
334
|
+
```
|
335
|
+
|
336
|
+
#### Type Case: #<Object:0x00007fcd219587b0>
|
337
|
+
|
338
|
+
```
|
339
|
+
Warming up --------------------------------------
|
340
|
+
== to_s.downcase 52.158k i/100ms
|
341
|
+
== casecmp 163.492k i/100ms
|
342
|
+
casecmp.zero? 240.188k i/100ms
|
343
|
+
casecmp.to_i.zero? 226.153k i/100ms
|
344
|
+
casecmp? 236.788k i/100ms
|
345
|
+
Calculating -------------------------------------
|
346
|
+
== to_s.downcase 640.939k (± 1.1%) i/s - 3.234M in 5.053840s
|
347
|
+
== casecmp 3.075M (± 0.9%) i/s - 15.368M in 5.008669s
|
348
|
+
casecmp.zero? 6.623M (± 0.9%) i/s - 33.146M in 5.020333s
|
349
|
+
casecmp.to_i.zero? 5.376M (± 1.2%) i/s - 26.912M in 5.027477s
|
350
|
+
casecmp? 6.726M (± 1.0%) i/s - 33.624M in 5.016239s
|
351
|
+
with 95.0% confidence
|
352
|
+
|
353
|
+
Comparison:
|
354
|
+
casecmp?: 6726445.6 i/s
|
355
|
+
casecmp.zero?: 6623328.3 i/s - same-ish: difference falls within error
|
356
|
+
casecmp.to_i.zero?: 5376386.8 i/s - 1.25x (± 0.02) slower
|
357
|
+
== casecmp: 3074731.3 i/s - 2.19x (± 0.03) slower
|
358
|
+
== to_s.downcase: 640938.7 i/s - 10.49x (± 0.15) slower
|
359
|
+
with 95.0% confidence
|
360
|
+
```
|
361
|
+
|
362
|
+
#### Type Case: #<StringLike:0x00007fcd21958788 @test_case="no match">
|
363
|
+
|
364
|
+
```
|
365
|
+
Warming up --------------------------------------
|
366
|
+
== to_s.downcase 52.238k i/100ms
|
367
|
+
== casecmp 212.362k i/100ms
|
368
|
+
casecmp.zero? 207.266k i/100ms
|
369
|
+
casecmp.to_i.zero? 203.147k i/100ms
|
370
|
+
casecmp? 179.658k i/100ms
|
371
|
+
Calculating -------------------------------------
|
372
|
+
== to_s.downcase 649.352k (± 0.9%) i/s - 3.291M in 5.074729s
|
373
|
+
== casecmp 5.069M (± 0.9%) i/s - 25.483M in 5.039082s
|
374
|
+
casecmp.zero? 4.852M (± 0.9%) i/s - 24.250M in 5.011911s
|
375
|
+
casecmp.to_i.zero? 4.395M (± 1.1%) i/s - 21.940M in 5.009899s
|
376
|
+
casecmp? 3.443M (± 1.3%) i/s - 17.247M in 5.028774s
|
377
|
+
with 95.0% confidence
|
378
|
+
|
379
|
+
Comparison:
|
380
|
+
== casecmp: 5068628.3 i/s
|
381
|
+
casecmp.zero?: 4851650.8 i/s - 1.04x (± 0.01) slower
|
382
|
+
casecmp.to_i.zero?: 4394669.1 i/s - 1.15x (± 0.02) slower
|
383
|
+
casecmp?: 3443238.5 i/s - 1.47x (± 0.02) slower
|
384
|
+
== to_s.downcase: 649351.6 i/s - 7.81x (± 0.10) slower
|
385
|
+
with 95.0% confidence
|
386
|
+
```
|
387
|
+
|
388
|
+
#### Type Case: #<StringLike:0x00007fcd21958760 @test_case="match">
|
389
|
+
|
390
|
+
```
|
391
|
+
Warming up --------------------------------------
|
392
|
+
== to_s.downcase 53.698k i/100ms
|
393
|
+
== casecmp 211.054k i/100ms
|
394
|
+
casecmp.zero? 209.614k i/100ms
|
395
|
+
casecmp.to_i.zero? 205.111k i/100ms
|
396
|
+
casecmp? 177.677k i/100ms
|
397
|
+
Calculating -------------------------------------
|
398
|
+
== to_s.downcase 642.352k (± 1.1%) i/s - 3.222M in 5.024341s
|
399
|
+
== casecmp 4.801M (± 0.9%) i/s - 24.060M in 5.023696s
|
400
|
+
casecmp.zero? 4.509M (± 0.9%) i/s - 22.638M in 5.032909s
|
401
|
+
casecmp.to_i.zero? 4.450M (± 1.2%) i/s - 22.357M in 5.044182s
|
402
|
+
casecmp? 3.332M (± 1.1%) i/s - 16.702M in 5.028767s
|
403
|
+
with 95.0% confidence
|
404
|
+
|
405
|
+
Comparison:
|
406
|
+
== casecmp: 4801157.9 i/s
|
407
|
+
casecmp.zero?: 4508944.8 i/s - 1.06x (± 0.01) slower
|
408
|
+
casecmp.to_i.zero?: 4449914.9 i/s - 1.08x (± 0.02) slower
|
409
|
+
casecmp?: 3332042.5 i/s - 1.44x (± 0.02) slower
|
410
|
+
== to_s.downcase: 642351.9 i/s - 7.47x (± 0.11) slower
|
411
|
+
with 95.0% confidence
|
412
|
+
```
|
413
|
+
|
414
|
+
#### Pre-check Case: nil
|
415
|
+
|
416
|
+
```
|
417
|
+
Warming up --------------------------------------
|
418
|
+
== casecmp(to_s) 222.939k i/100ms
|
419
|
+
casecmp?(to_s) 188.102k i/100ms
|
420
|
+
casecmp? 236.868k i/100ms
|
421
|
+
falsey casecmp.zero? 279.966k i/100ms
|
422
|
+
falsey == casecmp 282.745k i/100ms
|
423
|
+
!! casecmp.zero? 266.091k i/100ms
|
424
|
+
!! == casecmp 266.932k i/100ms
|
425
|
+
nil? casecmp.zero? 272.193k i/100ms
|
426
|
+
nil? == casecmp 273.029k i/100ms
|
427
|
+
Calculating -------------------------------------
|
428
|
+
== casecmp(to_s) 4.937M (± 1.0%) i/s - 24.746M in 5.024918s
|
429
|
+
casecmp?(to_s) 3.589M (± 1.1%) i/s - 18.058M in 5.046262s
|
430
|
+
casecmp? 6.417M (± 1.2%) i/s - 31.977M in 5.007501s
|
431
|
+
falsey casecmp.zero? 9.773M (± 1.0%) i/s - 48.714M in 5.008779s
|
432
|
+
falsey == casecmp 10.045M (± 0.9%) i/s - 50.046M in 5.001595s
|
433
|
+
!! casecmp.zero? 9.330M (± 0.9%) i/s - 46.566M in 5.009468s
|
434
|
+
!! == casecmp 8.754M (± 2.1%) i/s - 42.442M in 5.001546s
|
435
|
+
nil? casecmp.zero? 8.716M (± 1.0%) i/s - 43.551M in 5.017106s
|
436
|
+
nil? == casecmp 8.596M (± 0.8%) i/s - 42.866M in 5.000683s
|
437
|
+
with 95.0% confidence
|
438
|
+
|
439
|
+
Comparison:
|
440
|
+
falsey == casecmp: 10045375.1 i/s
|
441
|
+
falsey casecmp.zero?: 9772608.7 i/s - 1.03x (± 0.01) slower
|
442
|
+
!! casecmp.zero?: 9330161.0 i/s - 1.08x (± 0.01) slower
|
443
|
+
!! == casecmp: 8754421.4 i/s - 1.15x (± 0.03) slower
|
444
|
+
nil? casecmp.zero?: 8715727.1 i/s - 1.15x (± 0.02) slower
|
445
|
+
nil? == casecmp: 8595661.2 i/s - 1.17x (± 0.01) slower
|
446
|
+
casecmp?: 6417121.6 i/s - 1.57x (± 0.02) slower
|
447
|
+
== casecmp(to_s): 4936724.1 i/s - 2.03x (± 0.03) slower
|
448
|
+
casecmp?(to_s): 3588687.7 i/s - 2.80x (± 0.04) slower
|
449
|
+
with 95.0% confidence
|
450
|
+
```
|
451
|
+
|
452
|
+
#### Pre-check Case: "no match"
|
453
|
+
|
454
|
+
```
|
455
|
+
Warming up --------------------------------------
|
456
|
+
== casecmp(to_s) 245.036k i/100ms
|
457
|
+
casecmp?(to_s) 196.918k i/100ms
|
458
|
+
casecmp? 208.835k i/100ms
|
459
|
+
falsey casecmp.zero? 252.889k i/100ms
|
460
|
+
falsey == casecmp 253.206k i/100ms
|
461
|
+
!! casecmp.zero? 237.682k i/100ms
|
462
|
+
!! == casecmp 237.849k i/100ms
|
463
|
+
nil? casecmp.zero? 235.435k i/100ms
|
464
|
+
nil? == casecmp 242.031k i/100ms
|
465
|
+
Calculating -------------------------------------
|
466
|
+
== casecmp(to_s) 6.598M (± 1.0%) i/s - 33.080M in 5.031444s
|
467
|
+
casecmp?(to_s) 4.044M (± 1.2%) i/s - 20.283M in 5.036826s
|
468
|
+
casecmp? 4.503M (± 0.9%) i/s - 22.554M in 5.019573s
|
469
|
+
falsey casecmp.zero? 6.692M (± 0.8%) i/s - 33.634M in 5.036615s
|
470
|
+
falsey == casecmp 7.031M (± 0.9%) i/s - 35.196M in 5.018913s
|
471
|
+
!! casecmp.zero? 6.074M (± 1.1%) i/s - 30.423M in 5.029842s
|
472
|
+
!! == casecmp 6.146M (± 0.8%) i/s - 30.683M in 5.001632s
|
473
|
+
nil? casecmp.zero? 5.891M (± 0.8%) i/s - 29.429M in 5.006134s
|
474
|
+
nil? == casecmp 6.238M (± 0.8%) i/s - 31.222M in 5.015890s
|
475
|
+
with 95.0% confidence
|
476
|
+
|
477
|
+
Comparison:
|
478
|
+
falsey == casecmp: 7031044.2 i/s
|
479
|
+
falsey casecmp.zero?: 6691656.4 i/s - 1.05x (± 0.01) slower
|
480
|
+
== casecmp(to_s): 6598167.5 i/s - 1.07x (± 0.01) slower
|
481
|
+
nil? == casecmp: 6237735.7 i/s - 1.13x (± 0.01) slower
|
482
|
+
!! == casecmp: 6146232.8 i/s - 1.14x (± 0.01) slower
|
483
|
+
!! casecmp.zero?: 6073969.3 i/s - 1.16x (± 0.02) slower
|
484
|
+
nil? casecmp.zero?: 5890972.7 i/s - 1.19x (± 0.01) slower
|
485
|
+
casecmp?: 4503136.8 i/s - 1.56x (± 0.02) slower
|
486
|
+
casecmp?(to_s): 4043637.6 i/s - 1.74x (± 0.03) slower
|
487
|
+
with 95.0% confidence
|
488
|
+
```
|
data/bin/ci
CHANGED
@@ -15,7 +15,7 @@ bin/rspec
|
|
15
15
|
# bundle-audit provides patch-level verification for Bundler
|
16
16
|
# https://github.com/rubysec/bundler-audit.
|
17
17
|
echo " ---> Running bundler-audit"
|
18
|
-
gem install --no-
|
18
|
+
gem install --no-document bundler-audit
|
19
19
|
bundle-audit check --update
|
20
20
|
|
21
21
|
# Run style checker
|
data/common_rubocop.yml
CHANGED
@@ -4,12 +4,17 @@ AllCops:
|
|
4
4
|
# Exclude generated binstubs
|
5
5
|
- 'bin/bundle'
|
6
6
|
- 'bin/bundler-travis'
|
7
|
+
- 'bin/pronto'
|
7
8
|
- 'bin/pry'
|
9
|
+
- 'bin/radius-cli'
|
8
10
|
- 'bin/rake'
|
9
11
|
- 'bin/rspec'
|
10
12
|
- 'bin/rubocop'
|
11
13
|
- 'bin/travis'
|
14
|
+
- 'bin/webpack'
|
15
|
+
- 'bin/webpack-dev-server'
|
12
16
|
- 'bin/yard'
|
17
|
+
- 'bin/yarn'
|
13
18
|
# Exclude vendored content
|
14
19
|
- 'vendor/**/*'
|
15
20
|
|
@@ -25,6 +30,37 @@ Layout/AccessModifierIndentation:
|
|
25
30
|
similar to `rescue` and `ensure` in a method.
|
26
31
|
EnforcedStyle: outdent
|
27
32
|
|
33
|
+
# Rubocop 0.60.0 changed how it handled value alignments in this cop. This
|
34
|
+
# breaks our preference for wanting keys to be aligned, but allowing values to
|
35
|
+
# either use the `key` or `table` style:
|
36
|
+
#
|
37
|
+
# key_style = {
|
38
|
+
# key: :value,
|
39
|
+
# another: :value,
|
40
|
+
# yet_another: :value
|
41
|
+
# }
|
42
|
+
# table_style = {
|
43
|
+
# key: :value,
|
44
|
+
# another: :value
|
45
|
+
# yet_another: :value
|
46
|
+
# }
|
47
|
+
#
|
48
|
+
# This is logged with Rubocop: https://github.com/rubocop-hq/rubocop/issues/6410
|
49
|
+
#
|
50
|
+
# Until Rubocop resolves this we've decided to enforce the key style so that we
|
51
|
+
# do not lose all associated formatting checks. Additionally, in response to
|
52
|
+
# the referenced issue the Rubocop disables the alignment check by default. To
|
53
|
+
# continue using it we force enable it here.
|
54
|
+
#
|
55
|
+
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
56
|
+
# SupportedHashRocketStyles: key, separator, table
|
57
|
+
# SupportedColonStyles: key, separator, table
|
58
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
59
|
+
Layout/AlignHash:
|
60
|
+
Enabled: true
|
61
|
+
EnforcedHashRocketStyle: key
|
62
|
+
EnforcedColonStyle: key
|
63
|
+
|
28
64
|
# Disabling this until it is fixed to support multi-line block chains using the
|
29
65
|
# semantic style.
|
30
66
|
#
|
@@ -107,7 +143,10 @@ Metrics/BlockLength:
|
|
107
143
|
- 'spec/**/*_spec.rb'
|
108
144
|
- 'spec/support/model_factories.rb'
|
109
145
|
ExcludedMethods:
|
146
|
+
- 'chdir'
|
110
147
|
- 'refine'
|
148
|
+
- 'Capybara.register_driver'
|
149
|
+
- 'Gem::Specification.new'
|
111
150
|
- 'RSpec.configure'
|
112
151
|
- 'VCR.configure'
|
113
152
|
|
@@ -143,6 +182,8 @@ Metrics/LineLength:
|
|
143
182
|
# Attempt at trailing comments
|
144
183
|
- '\A.{1,78}\s#\s.*\z'
|
145
184
|
Max: 100
|
185
|
+
Exclude:
|
186
|
+
- '**/*.gemspec'
|
146
187
|
|
147
188
|
# This is overly pedantic (only allowing `other` as the parameter name). Ruby
|
148
189
|
# core doesn't follow this consistently either. Looking at several classes
|
data/common_rubocop_rails.yml
CHANGED
@@ -27,6 +27,8 @@ Documentation:
|
|
27
27
|
|
28
28
|
Metrics/BlockLength:
|
29
29
|
Exclude:
|
30
|
+
- 'bin/setup'
|
31
|
+
- 'bin/update'
|
30
32
|
- 'config/routes.rb'
|
31
33
|
- 'spec/rails_helper.rb'
|
32
34
|
|
@@ -220,17 +222,13 @@ Rails/SaveBang:
|
|
220
222
|
# - http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html
|
221
223
|
# - http://api.rubyonrails.org/classes/ActiveRecord/Relation.html
|
222
224
|
#
|
225
|
+
# Configuration parameters: Blacklist, Whitelist.
|
223
226
|
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
224
227
|
Rails/SkipsModelValidations:
|
225
|
-
|
226
|
-
- '
|
227
|
-
- '
|
228
|
-
- '
|
229
|
-
- 'update_all'
|
230
|
-
- 'update_attribute'
|
231
|
-
- 'update_column'
|
232
|
-
- 'update_columns'
|
233
|
-
- 'update_counters'
|
228
|
+
Whitelist:
|
229
|
+
- 'decrement!'
|
230
|
+
- 'increment!'
|
231
|
+
- 'touch'
|
234
232
|
|
235
233
|
# Rails uses compact style by default so we're disabling this with a :hammer:
|
236
234
|
# for things likely to be generated by Rails (i.e. most things in app).
|
data/lib/radius/spec/version.rb
CHANGED
data/radius-spec.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.required_ruby_version = ">= 2.5"
|
32
32
|
|
33
33
|
spec.add_runtime_dependency "rspec", "~> 3.7"
|
34
|
-
spec.add_runtime_dependency "rubocop", "~> 0.
|
34
|
+
spec.add_runtime_dependency "rubocop", "~> 0.62.0"
|
35
35
|
|
36
36
|
spec.add_development_dependency "bundler", "~> 1.16"
|
37
37
|
spec.add_development_dependency "rake", "~> 12.0"
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radius-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Radius Networks
|
8
8
|
- Aaron Kromer
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 0.62.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
41
|
+
version: 0.62.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: bundler
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- benchmarks/bm_setup.rb
|
89
89
|
- benchmarks/call_vs_yield.rb
|
90
90
|
- benchmarks/case_equality_vs_class_check.rb
|
91
|
+
- benchmarks/casecmp_vs_downcase.rb
|
91
92
|
- benchmarks/cover_vs_include.rb
|
92
93
|
- benchmarks/delete_vs_tr.rb
|
93
94
|
- benchmarks/double_negation.rb
|
@@ -126,9 +127,9 @@ licenses:
|
|
126
127
|
- Apache-2.0
|
127
128
|
metadata:
|
128
129
|
bug_tracker_uri: https://github.com/RadiusNetworks/radius-spec/issues
|
129
|
-
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.
|
130
|
-
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.
|
131
|
-
post_install_message:
|
130
|
+
changelog_uri: https://github.com/RadiusNetworks/radius-spec/blob/v0.6.0/CHANGELOG.md
|
131
|
+
source_code_uri: https://github.com/RadiusNetworks/radius-spec/tree/v0.6.0
|
132
|
+
post_install_message:
|
132
133
|
rdoc_options: []
|
133
134
|
require_paths:
|
134
135
|
- lib
|
@@ -143,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
144
|
- !ruby/object:Gem::Version
|
144
145
|
version: '0'
|
145
146
|
requirements: []
|
146
|
-
|
147
|
-
|
148
|
-
signing_key:
|
147
|
+
rubygems_version: 3.0.3
|
148
|
+
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Radius Networks RSpec setup and plug-ins
|
151
151
|
test_files: []
|