in_array 0.1.8 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99b90ae3b01b6f9777b8185365fc42d8b3df1d10
4
- data.tar.gz: 63c18b185627a5f3dd737ca6542e0a5318c26888
3
+ metadata.gz: 95907753a04429de9964d7f27920a53dfc6191ee
4
+ data.tar.gz: 7d38abadf2bb61d4d18f40dc810837a4aff9caff
5
5
  SHA512:
6
- metadata.gz: df60c7b3ef17864b9ba746855b5efb369ba5221070089b8e4a1bc17a29134336ca1e09d02310f7949fd60cbc765af9a9ed39963c093f5cfca4e2615e59fc8d5d
7
- data.tar.gz: dc52df405bef3166e985552b2221b020f88c4b895065f6b8e6227ceacc62efa71188bab80bb11a24dec92b54e2f690fea6a3f7114a0d58d3dd214cea9496e930
6
+ metadata.gz: f3fc623ca70ec10b9c3ed6e6a34a085083cc7bb9f0c74eba9d0477ae4d646cb5004e9f8ec8bc0bf96d127b7bf089c97a1527ecd7ed6e275afed5c5ecf48b5933
7
+ data.tar.gz: 515d17c19f188634a3879d9c5ad8d98731cd511965eae928612fd340d5f0f998d4ddf954adbaa022d34abcab72dae19da94d8cba2dce000ee68afb6c31b14bdc
data/README.md CHANGED
@@ -82,49 +82,50 @@ penalty. The benchmark tests that follow show that the in_array gem should be
82
82
  expected to improve performance when compared with the simulated polymorphism
83
83
  alternative.
84
84
 
85
+ All benchmarks were done with:
86
+ ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
87
+
85
88
  The first test assumes a simple scenario with only the Array class. Polymorphism
86
89
  is simulated using the is_a? method:
87
90
 
88
- C:\Sites\in_array>ruby bench\simple_bench.rb
89
91
  Warming up --------------------------------------
90
92
  Process with in_array
91
- 5.178k i/100ms
93
+ 5.332k i/100ms
92
94
  Process with is_a?
93
- 4.037k i/100ms
95
+ 4.084k i/100ms
94
96
  Calculating -------------------------------------
95
97
  Process with in_array
96
- 54.001k5.4%) i/s - 274.434k
98
+ 60.573k0.2%) i/s - 303.924k in 5.017537s
97
99
  Process with is_a?
98
- 41.897k5.3%) i/s - 209.924k
100
+ 45.736k0.2%) i/s - 228.704k in 5.000545s
99
101
 
100
102
  Comparison:
101
- Process with in_array: 54000.9 i/s
102
- Process with is_a? : 41897.1 i/s - 1.29x slower
103
+ Process with in_array: 60572.6 i/s
104
+ Process with is_a? : 45736.0 i/s - 1.32x slower
103
105
 
104
106
  The second scenario adds a user defined array like class. In this case, two
105
107
  methods of simulated polymorphism are tested, based on include? and a hash
106
108
  of allowed array classes. Here are those results.
107
109
 
108
- C:\Sites\in_array>ruby bench\complex_bench.rb
109
110
  Warming up --------------------------------------
110
111
  Process with in_array
111
- 5.163k i/100ms
112
+ 5.334k i/100ms
112
113
  Process with hash[]
113
- 1.779k i/100ms
114
+ 1.565k i/100ms
114
115
  Process with include?
115
- 1.895k i/100ms
116
+ 2.656k i/100ms
116
117
  Calculating -------------------------------------
117
118
  Process with in_array
118
- 54.239k5.3%) i/s - 273.639k
119
+ 60.959k0.3%) i/s - 309.372k in 5.075113s
119
120
  Process with hash[]
120
- 17.924k3.2%) i/s - 90.729k
121
+ 16.323k0.7%) i/s - 82.945k in 5.081691s
121
122
  Process with include?
122
- 19.232k3.8%) i/s - 96.645k
123
+ 28.529k0.2%) i/s - 143.424k in 5.027394s
123
124
 
124
125
  Comparison:
125
- Process with in_array: 54238.6 i/s
126
- Process with include?: 19231.7 i/s - 2.82x slower
127
- Process with hash[] : 17923.9 i/s - 3.03x slower
126
+ Process with in_array: 60959.3 i/s
127
+ Process with include?: 28528.6 i/s - 2.14x slower
128
+ Process with hash[] : 16323.1 i/s - 3.73x slower
128
129
 
129
130
  ## Contributing
130
131
 
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rake'
22
22
  s.add_development_dependency 'minitest', "~> 5.7"
23
23
  s.add_development_dependency 'minitest_visible', "~> 0.1"
24
- s.add_development_dependency 'reek', "~> 4.5"
24
+ s.add_development_dependency 'reek', "~> 5.0.2"
25
25
  s.add_development_dependency 'rdoc', "~> 5.0"
26
26
 
27
27
  s.files = `git ls-files`.split($/)
@@ -3,5 +3,5 @@
3
3
  #* version.rb - The version string for flex array.
4
4
  module InArray
5
5
  #The version string for flex array.
6
- VERSION = "0.1.8"
6
+ VERSION = "1.0.0"
7
7
  end
@@ -2,26 +2,17 @@
2
2
  # coding: utf-8
3
3
 
4
4
  require 'rake/testtask'
5
- require 'rdoc/task'
6
5
  require "bundler/gem_tasks"
7
6
 
8
- RDoc::Task.new do |rdoc|
9
- rdoc.rdoc_dir = "rdoc"
10
-
11
- #List out all the files to be documented.
12
- rdoc.rdoc_files.include("lib/**/*.rb", "license.txt", "readme.md")
13
-
14
- rdoc.options << '--visibility' << 'private'
15
- end
16
-
17
7
  Rake::TestTask.new do |t|
18
8
  t.test_files = ['tests/in_array_test.rb']
19
9
  t.verbose = false
10
+ t.warning = true
20
11
  end
21
12
 
22
13
  desc "Run a scan for smelly code!"
23
14
  task :reek do |t|
24
- `reek lib\\*.rb > reek.txt`
15
+ `reek --no-color lib > reek.txt`
25
16
  end
26
17
 
27
18
  desc "Fire up an IRB session with in_array preloaded."
data/reek.txt CHANGED
@@ -1 +1 @@
1
- lib/in_array.rb -- 0 warnings
1
+ 0 total warnings
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: in_array
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-13 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '4.5'
75
+ version: 5.0.2
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '4.5'
82
+ version: 5.0.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rdoc
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -135,10 +135,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.2.3
138
+ rubygems_version: 2.5.2
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Encapsulate data in an array.
142
142
  test_files:
143
143
  - tests/in_array_test.rb
144
- has_rdoc: true