excon 0.62.0 → 0.92.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +5 -5
  2. data/CONTRIBUTING.md +0 -1
  3. data/LICENSE.md +1 -1
  4. data/README.md +7 -6
  5. data/data/cacert.pem +1220 -1828
  6. data/excon.gemspec +19 -3
  7. data/lib/excon/connection.rb +216 -139
  8. data/lib/excon/constants.rb +38 -13
  9. data/lib/excon/error.rb +15 -0
  10. data/lib/excon/headers.rb +4 -3
  11. data/lib/excon/instrumentors/logging_instrumentor.rb +5 -16
  12. data/lib/excon/instrumentors/standard_instrumentor.rb +2 -9
  13. data/lib/excon/middlewares/base.rb +6 -0
  14. data/lib/excon/middlewares/capture_cookies.rb +1 -1
  15. data/lib/excon/middlewares/decompress.rb +11 -4
  16. data/lib/excon/middlewares/expects.rb +7 -1
  17. data/lib/excon/middlewares/idempotent.rb +20 -3
  18. data/lib/excon/middlewares/instrumentor.rb +8 -0
  19. data/lib/excon/middlewares/mock.rb +12 -3
  20. data/lib/excon/middlewares/redirect_follower.rb +25 -3
  21. data/lib/excon/middlewares/response_parser.rb +3 -0
  22. data/lib/excon/pretty_printer.rb +1 -8
  23. data/lib/excon/response.rb +12 -9
  24. data/lib/excon/socket.rb +59 -42
  25. data/lib/excon/ssl_socket.rb +37 -15
  26. data/lib/excon/test/plugin/server/exec.rb +5 -2
  27. data/lib/excon/test/plugin/server/puma.rb +4 -1
  28. data/lib/excon/test/plugin/server/unicorn.rb +5 -0
  29. data/lib/excon/test/plugin/server/webrick.rb +4 -1
  30. data/lib/excon/test/server.rb +1 -1
  31. data/lib/excon/unix_socket.rb +1 -0
  32. data/lib/excon/utils.rb +59 -5
  33. data/lib/excon/version.rb +1 -1
  34. data/lib/excon.rb +25 -17
  35. metadata +27 -98
  36. data/.document +0 -5
  37. data/.gitignore +0 -13
  38. data/.rspec +0 -3
  39. data/.travis.yml +0 -29
  40. data/Gemfile +0 -19
  41. data/Rakefile +0 -41
  42. data/benchmarks/class_vs_lambda.rb +0 -50
  43. data/benchmarks/concat_vs_insert.rb +0 -21
  44. data/benchmarks/concat_vs_interpolate.rb +0 -22
  45. data/benchmarks/cr_lf.rb +0 -21
  46. data/benchmarks/downcase-eq-eq_vs_casecmp.rb +0 -169
  47. data/benchmarks/excon.rb +0 -69
  48. data/benchmarks/excon_vs.rb +0 -165
  49. data/benchmarks/for_vs_array_each.rb +0 -27
  50. data/benchmarks/for_vs_hash_each.rb +0 -27
  51. data/benchmarks/has_key-vs-lookup.rb +0 -177
  52. data/benchmarks/headers_case_sensitivity.rb +0 -83
  53. data/benchmarks/headers_split_vs_match.rb +0 -34
  54. data/benchmarks/implicit_block-vs-explicit_block.rb +0 -98
  55. data/benchmarks/merging.rb +0 -21
  56. data/benchmarks/single_vs_double_quotes.rb +0 -21
  57. data/benchmarks/string_ranged_index.rb +0 -87
  58. data/benchmarks/strip_newline.rb +0 -115
  59. data/benchmarks/vs_stdlib.rb +0 -82
  60. data/changelog.txt +0 -1083
  61. data/spec/excon/error_spec.rb +0 -139
  62. data/spec/excon/test/server_spec.rb +0 -28
  63. data/spec/excon_spec.rb +0 -7
  64. data/spec/helpers/file_path_helpers.rb +0 -22
  65. data/spec/requests/basic_spec.rb +0 -40
  66. data/spec/requests/eof_requests_spec.rb +0 -36
  67. data/spec/requests/unix_socket_spec.rb +0 -46
  68. data/spec/spec_helper.rb +0 -24
  69. data/spec/support/shared_contexts/test_server_context.rb +0 -83
  70. data/spec/support/shared_examples/shared_example_for_clients.rb +0 -218
  71. data/spec/support/shared_examples/shared_example_for_streaming_clients.rb +0 -20
  72. data/spec/support/shared_examples/shared_example_for_test_servers.rb +0 -16
  73. data/tests/authorization_header_tests.rb +0 -29
  74. data/tests/bad_tests.rb +0 -47
  75. data/tests/basic_tests.rb +0 -351
  76. data/tests/batch_requests.rb +0 -133
  77. data/tests/complete_responses.rb +0 -31
  78. data/tests/data/127.0.0.1.cert.crt +0 -20
  79. data/tests/data/127.0.0.1.cert.key +0 -27
  80. data/tests/data/excon.cert.crt +0 -20
  81. data/tests/data/excon.cert.key +0 -27
  82. data/tests/data/xs +0 -1
  83. data/tests/error_tests.rb +0 -145
  84. data/tests/header_tests.rb +0 -119
  85. data/tests/middlewares/canned_response_tests.rb +0 -34
  86. data/tests/middlewares/capture_cookies_tests.rb +0 -34
  87. data/tests/middlewares/decompress_tests.rb +0 -157
  88. data/tests/middlewares/escape_path_tests.rb +0 -36
  89. data/tests/middlewares/idempotent_tests.rb +0 -206
  90. data/tests/middlewares/instrumentation_tests.rb +0 -315
  91. data/tests/middlewares/mock_tests.rb +0 -304
  92. data/tests/middlewares/redirect_follower_tests.rb +0 -112
  93. data/tests/pipeline_tests.rb +0 -40
  94. data/tests/proxy_tests.rb +0 -306
  95. data/tests/query_string_tests.rb +0 -87
  96. data/tests/rackups/basic.rb +0 -41
  97. data/tests/rackups/basic.ru +0 -3
  98. data/tests/rackups/basic_auth.ru +0 -14
  99. data/tests/rackups/deflater.ru +0 -4
  100. data/tests/rackups/proxy.ru +0 -18
  101. data/tests/rackups/query_string.ru +0 -13
  102. data/tests/rackups/redirecting.ru +0 -23
  103. data/tests/rackups/redirecting_with_cookie.ru +0 -40
  104. data/tests/rackups/request_headers.ru +0 -15
  105. data/tests/rackups/request_methods.ru +0 -21
  106. data/tests/rackups/response_header.ru +0 -18
  107. data/tests/rackups/ssl.ru +0 -16
  108. data/tests/rackups/ssl_mismatched_cn.ru +0 -15
  109. data/tests/rackups/ssl_verify_peer.ru +0 -16
  110. data/tests/rackups/streaming.ru +0 -30
  111. data/tests/rackups/thread_safety.ru +0 -17
  112. data/tests/rackups/timeout.ru +0 -14
  113. data/tests/rackups/webrick_patch.rb +0 -34
  114. data/tests/request_headers_tests.rb +0 -21
  115. data/tests/request_method_tests.rb +0 -47
  116. data/tests/request_tests.rb +0 -59
  117. data/tests/response_tests.rb +0 -197
  118. data/tests/servers/bad.rb +0 -20
  119. data/tests/servers/eof.rb +0 -17
  120. data/tests/servers/error.rb +0 -20
  121. data/tests/servers/good.rb +0 -350
  122. data/tests/test_helper.rb +0 -306
  123. data/tests/thread_safety_tests.rb +0 -39
  124. data/tests/timeout_tests.rb +0 -12
  125. data/tests/utils_tests.rb +0 -81
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.0
4
+ version: 0.92.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dpiddy (Dan Peterson)
8
8
  - geemus (Wesley Beary)
9
9
  - nextmat (Matt Sanders)
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-03-27 00:00:00.000000000 Z
13
+ date: 2022-04-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -180,6 +180,20 @@ dependencies:
180
180
  - - ">="
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
+ - !ruby/object:Gem::Dependency
184
+ name: webrick
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
183
197
  description: EXtended http(s) CONnections
184
198
  email: geemus@gmail.com
185
199
  executables: []
@@ -189,35 +203,10 @@ extra_rdoc_files:
189
203
  - CONTRIBUTORS.md
190
204
  - CONTRIBUTING.md
191
205
  files:
192
- - ".document"
193
- - ".gitignore"
194
- - ".rspec"
195
- - ".travis.yml"
196
206
  - CONTRIBUTING.md
197
207
  - CONTRIBUTORS.md
198
- - Gemfile
199
208
  - LICENSE.md
200
209
  - README.md
201
- - Rakefile
202
- - benchmarks/class_vs_lambda.rb
203
- - benchmarks/concat_vs_insert.rb
204
- - benchmarks/concat_vs_interpolate.rb
205
- - benchmarks/cr_lf.rb
206
- - benchmarks/downcase-eq-eq_vs_casecmp.rb
207
- - benchmarks/excon.rb
208
- - benchmarks/excon_vs.rb
209
- - benchmarks/for_vs_array_each.rb
210
- - benchmarks/for_vs_hash_each.rb
211
- - benchmarks/has_key-vs-lookup.rb
212
- - benchmarks/headers_case_sensitivity.rb
213
- - benchmarks/headers_split_vs_match.rb
214
- - benchmarks/implicit_block-vs-explicit_block.rb
215
- - benchmarks/merging.rb
216
- - benchmarks/single_vs_double_quotes.rb
217
- - benchmarks/string_ranged_index.rb
218
- - benchmarks/strip_newline.rb
219
- - benchmarks/vs_stdlib.rb
220
- - changelog.txt
221
210
  - data/cacert.pem
222
211
  - excon.gemspec
223
212
  - lib/excon.rb
@@ -250,76 +239,17 @@ files:
250
239
  - lib/excon/unix_socket.rb
251
240
  - lib/excon/utils.rb
252
241
  - lib/excon/version.rb
253
- - spec/excon/error_spec.rb
254
- - spec/excon/test/server_spec.rb
255
- - spec/excon_spec.rb
256
- - spec/helpers/file_path_helpers.rb
257
- - spec/requests/basic_spec.rb
258
- - spec/requests/eof_requests_spec.rb
259
- - spec/requests/unix_socket_spec.rb
260
- - spec/spec_helper.rb
261
- - spec/support/shared_contexts/test_server_context.rb
262
- - spec/support/shared_examples/shared_example_for_clients.rb
263
- - spec/support/shared_examples/shared_example_for_streaming_clients.rb
264
- - spec/support/shared_examples/shared_example_for_test_servers.rb
265
- - tests/authorization_header_tests.rb
266
- - tests/bad_tests.rb
267
- - tests/basic_tests.rb
268
- - tests/batch_requests.rb
269
- - tests/complete_responses.rb
270
- - tests/data/127.0.0.1.cert.crt
271
- - tests/data/127.0.0.1.cert.key
272
- - tests/data/excon.cert.crt
273
- - tests/data/excon.cert.key
274
- - tests/data/xs
275
- - tests/error_tests.rb
276
- - tests/header_tests.rb
277
- - tests/middlewares/canned_response_tests.rb
278
- - tests/middlewares/capture_cookies_tests.rb
279
- - tests/middlewares/decompress_tests.rb
280
- - tests/middlewares/escape_path_tests.rb
281
- - tests/middlewares/idempotent_tests.rb
282
- - tests/middlewares/instrumentation_tests.rb
283
- - tests/middlewares/mock_tests.rb
284
- - tests/middlewares/redirect_follower_tests.rb
285
- - tests/pipeline_tests.rb
286
- - tests/proxy_tests.rb
287
- - tests/query_string_tests.rb
288
- - tests/rackups/basic.rb
289
- - tests/rackups/basic.ru
290
- - tests/rackups/basic_auth.ru
291
- - tests/rackups/deflater.ru
292
- - tests/rackups/proxy.ru
293
- - tests/rackups/query_string.ru
294
- - tests/rackups/redirecting.ru
295
- - tests/rackups/redirecting_with_cookie.ru
296
- - tests/rackups/request_headers.ru
297
- - tests/rackups/request_methods.ru
298
- - tests/rackups/response_header.ru
299
- - tests/rackups/ssl.ru
300
- - tests/rackups/ssl_mismatched_cn.ru
301
- - tests/rackups/ssl_verify_peer.ru
302
- - tests/rackups/streaming.ru
303
- - tests/rackups/thread_safety.ru
304
- - tests/rackups/timeout.ru
305
- - tests/rackups/webrick_patch.rb
306
- - tests/request_headers_tests.rb
307
- - tests/request_method_tests.rb
308
- - tests/request_tests.rb
309
- - tests/response_tests.rb
310
- - tests/servers/bad.rb
311
- - tests/servers/eof.rb
312
- - tests/servers/error.rb
313
- - tests/servers/good.rb
314
- - tests/test_helper.rb
315
- - tests/thread_safety_tests.rb
316
- - tests/timeout_tests.rb
317
- - tests/utils_tests.rb
318
242
  homepage: https://github.com/excon/excon
319
243
  licenses:
320
244
  - MIT
321
- metadata: {}
322
- post_install_message:
245
+ metadata:
246
+ homepage_uri: https://github.com/excon/excon
247
+ bug_tracker_uri: https://github.com/excon/excon/issues
248
+ changelog_uri: https://github.com/excon/excon/blob/master/changelog.txt
249
+ documentation_uri: https://github.com/excon/excon/blob/master/README.md
250
+ source_code_uri: https://github.com/excon/excon
251
+ wiki_uri: https://github.com/excon/excon/wiki
252
+ post_install_message:
323
253
  rdoc_options:
324
254
  - "--charset=UTF-8"
325
255
  require_paths:
@@ -335,9 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
335
265
  - !ruby/object:Gem::Version
336
266
  version: '0'
337
267
  requirements: []
338
- rubyforge_project:
339
- rubygems_version: 2.6.13
340
- signing_key:
268
+ rubygems_version: 3.3.5
269
+ signing_key:
341
270
  specification_version: 4
342
271
  summary: speed, persistence, http(s)
343
272
  test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- *.rbc
2
- *.sw?
3
- .bundle
4
- .DS_Store
5
- .yardoc
6
- .rvmrc
7
- .ruby-version
8
- .ruby-gemset
9
- coverage
10
- doc
11
- rdoc
12
- pkg
13
- Gemfile.lock
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --format d
data/.travis.yml DELETED
@@ -1,29 +0,0 @@
1
- before_install:
2
- - gem install bundler
3
- language: ruby
4
- matrix:
5
- allow_failures:
6
- - rvm: 1.8.7
7
- - rvm: 1.9.2
8
- - rvm: jruby
9
- - rvm: rbx-3.2
10
- - rvm: ree
11
- fast_finish: true
12
- rvm:
13
- - 1.8.7
14
- - 1.9.2
15
- - 1.9.3
16
- - 2.0
17
- - 2.1
18
- - 2.2
19
- - 2.3
20
- - 2.4
21
- - 2.5
22
- - jruby
23
- - rbx-3.2
24
- - ree
25
- script:
26
- - "bundle exec shindont"
27
- - "bundle exec rake spec[progress]"
28
-
29
- sudo: false
data/Gemfile DELETED
@@ -1,19 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- gem 'jruby-openssl', '~> 0.9', :platform => :jruby
6
- gem 'unicorn', :platforms => [:mri, :rbx], :groups => [:development, :test]
7
- gem 'rubysl', '~> 2.0', :platform => :rbx
8
- gem 'rack', '~> 1.6'
9
-
10
- # group :benchmark do
11
- # gem 'em-http-request'
12
- # gem 'httparty'
13
- # gem 'rest-client'
14
- # gem 'tach'
15
- # gem 'typhoeus'
16
- # gem 'sinatra'
17
- # gem 'streamly_ffi'
18
- # gem 'curb'
19
- # end
data/Rakefile DELETED
@@ -1,41 +0,0 @@
1
- require 'shindo/rake'
2
- require 'rspec/core/rake_task'
3
- require 'bundler/gem_tasks'
4
- require 'rdoc/task'
5
-
6
- Shindo::Rake.new
7
-
8
- RSpec::Core::RakeTask.new(:spec, :format) do |t, args|
9
- format = args[:format] || 'doc'
10
- t.rspec_opts = ["-c", "-f #{format}", "-r ./spec/spec_helper.rb"]
11
- t.pattern = 'spec/**/*_spec.rb'
12
- end
13
-
14
- task :default => [:tests, :test]
15
- task :test => :spec
16
-
17
- desc "update bundled certs"
18
- task :update_certs do
19
- # update curl bundle for end-users
20
- require File.join(File.dirname(__FILE__), 'lib', 'excon')
21
- File.open(File.join(File.dirname(__FILE__), 'data', 'cacert.pem'), 'w') do |file|
22
- data = Excon.get("https://curl.haxx.se/ca/cacert.pem").body
23
- file.write(data)
24
- end
25
-
26
- # update self-signed certs for tests
27
- sh "openssl req -subj '/CN=excon/O=excon' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout tests/data/excon.cert.key -out tests/data/excon.cert.crt"
28
- sh "openssl req -subj '/CN=127.0.0.1/O=excon' -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout tests/data/127.0.0.1.cert.key -out tests/data/127.0.0.1.cert.crt"
29
- end
30
-
31
- desc "Open an irb session preloaded with this library"
32
- task :console do
33
- sh "irb -rubygems -r ./lib/#{name}.rb"
34
- end
35
-
36
- desc "check ssl settings"
37
- task :hows_my_ssl do
38
- require File.join(File.dirname(__FILE__), 'lib', 'excon')
39
- data = Excon.get("https://www.howsmyssl.com/a/check").body
40
- puts data
41
- end
@@ -1,50 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- class Concatenator
5
- def initialize(string)
6
- @string = string
7
- end
8
-
9
- def call(data)
10
- @string << data
11
- end
12
- end
13
-
14
- string = "0123456789ABCDEF"
15
-
16
- Tach.meter(100_000) do
17
- tach('class') do
18
- s = ""
19
- obj = Concatenator.new(s)
20
- 10.times { obj.call(string) }
21
- end
22
-
23
- tach('lambda') do
24
- s = ""
25
- obj = lambda {|data| s << data }
26
- 10.times { obj.call(string) }
27
- end
28
- end
29
-
30
- # ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]
31
- #
32
- # +--------+----------+
33
- # | tach | total |
34
- # +--------+----------+
35
- # | class | 1.450284 |
36
- # +--------+----------+
37
- # | lambda | 2.506496 |
38
- # +--------+----------+
39
-
40
- # ruby 1.8.7 (2010-12-23 patchlevel 330) [x86_64-linux]
41
- #
42
- # +--------+----------+
43
- # | tach | total |
44
- # +--------+----------+
45
- # | class | 1.373917 |
46
- # +--------+----------+
47
- # | lambda | 2.589384 |
48
- # +--------+----------+
49
-
50
-
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- Tach.meter(1_000_000) do
5
- tach('concat') do
6
- path = 'path'
7
- path = '/' << path
8
- end
9
- tach('insert') do
10
- path = 'path'
11
- path.insert(0, '/')
12
- end
13
- end
14
-
15
- # +--------+----------+
16
- # | tach | total |
17
- # +--------+----------+
18
- # | insert | 0.974036 |
19
- # +--------+----------+
20
- # | concat | 0.998904 |
21
- # +--------+----------+
@@ -1,22 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- key = 'Content-Length'
5
- value = '100'
6
- Tach.meter(1_000) do
7
- tach('concat') do
8
- temp = ''
9
- temp << key << ': ' << value << "\r\n"
10
- end
11
- tach('interpolate') do
12
- "#{key}: #{value}\r\n"
13
- end
14
- end
15
-
16
- # +-------------+----------+
17
- # | tach | total |
18
- # +-------------+----------+
19
- # | interpolate | 0.000404 |
20
- # +-------------+----------+
21
- # | concat | 0.000564 |
22
- # +-------------+----------+
data/benchmarks/cr_lf.rb DELETED
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'tach'
3
-
4
- CR_LF = "\r\n"
5
-
6
- Tach.meter(1_000_000) do
7
- tach('constant') do
8
- '' << CR_LF
9
- end
10
- tach('string') do
11
- '' << "\r\n"
12
- end
13
- end
14
-
15
- # +----------+----------+
16
- # | tach | total |
17
- # +----------+----------+
18
- # | constant | 0.819885 |
19
- # +----------+----------+
20
- # | string | 0.893602 |
21
- # +----------+----------+
@@ -1,169 +0,0 @@
1
- # Copied from my benchmark_hell repo: github.com/sgonyea/benchmark_hell
2
-
3
- require 'benchmark'
4
-
5
- iters = 1000000
6
-
7
- comp = "hello"
8
- hello = "HelLo"
9
-
10
- puts 'String#downcase == vs. String#casecmp'
11
- Benchmark.bmbm do |x|
12
- x.report('String#downcase1') do
13
- iters.times.each do
14
- hello.downcase == comp
15
- end
16
- end
17
-
18
- x.report('String#downcase2') do
19
- iters.times.each do
20
- "HelLo".downcase == "hello"
21
- end
22
- end
23
-
24
- x.report('String#downcase3') do
25
- iters.times.each do
26
- var = "HelLo"
27
- var.downcase!
28
- var == "hello"
29
- end
30
- end
31
-
32
- x.report('casecmp1') do
33
- iters.times.each do
34
- hello.casecmp(comp).zero?
35
- end
36
- end
37
-
38
- x.report('casecmp1-1') do
39
- iters.times.each do
40
- hello.casecmp(comp) == 0
41
- end
42
- end
43
-
44
- x.report('casecmp2') do
45
- iters.times.each do
46
- "HelLo".casecmp(comp).zero?
47
- end
48
- end
49
-
50
- x.report('casecmp2-1') do
51
- iters.times.each do
52
- "HelLo".casecmp(comp) == 0
53
- end
54
- end
55
- end
56
-
57
- =begin
58
- rvm exec bash -c 'echo && echo $RUBY_VERSION && echo && ruby downcase-eq-eq_vs_casecmp.rb'
59
-
60
- jruby-1.5.6
61
-
62
- String#downcase == vs. String#casecmp
63
- Rehearsal ----------------------------------------------------
64
- String#downcase1 0.461000 0.000000 0.461000 ( 0.387000)
65
- String#downcase2 0.269000 0.000000 0.269000 ( 0.269000)
66
- String#downcase3 0.224000 0.000000 0.224000 ( 0.224000)
67
- casecmp1 0.157000 0.000000 0.157000 ( 0.157000)
68
- casecmp1-1 0.153000 0.000000 0.153000 ( 0.153000)
69
- casecmp2 0.163000 0.000000 0.163000 ( 0.163000)
70
- casecmp2-1 0.163000 0.000000 0.163000 ( 0.163000)
71
- ------------------------------------------- total: 1.590000sec
72
-
73
- user system total real
74
- String#downcase1 0.190000 0.000000 0.190000 ( 0.191000)
75
- String#downcase2 0.225000 0.000000 0.225000 ( 0.225000)
76
- String#downcase3 0.190000 0.000000 0.190000 ( 0.190000)
77
- casecmp1 0.125000 0.000000 0.125000 ( 0.125000)
78
- casecmp1-1 0.127000 0.000000 0.127000 ( 0.127000)
79
- casecmp2 0.144000 0.000000 0.144000 ( 0.144000)
80
- casecmp2-1 0.147000 0.000000 0.147000 ( 0.147000)
81
-
82
- macruby-0.7.1
83
-
84
- String#downcase == vs. String#casecmp
85
- Rehearsal ----------------------------------------------------
86
- String#downcase1 2.340000 0.040000 2.380000 ( 1.765141)
87
- String#downcase2 5.510000 0.100000 5.610000 ( 3.893249)
88
- String#downcase3 4.200000 0.080000 4.280000 ( 3.031621)
89
- casecmp1 0.270000 0.000000 0.270000 ( 0.267613)
90
- casecmp1-1 0.190000 0.000000 0.190000 ( 0.188848)
91
- casecmp2 1.450000 0.020000 1.470000 ( 1.027956)
92
- casecmp2-1 1.380000 0.030000 1.410000 ( 0.951474)
93
- ------------------------------------------ total: 15.610000sec
94
-
95
- user system total real
96
- String#downcase1 2.350000 0.040000 2.390000 ( 1.774292)
97
- String#downcase2 5.890000 0.120000 6.010000 ( 4.214038)
98
- String#downcase3 4.530000 0.090000 4.620000 ( 3.286059)
99
- casecmp1 0.270000 0.000000 0.270000 ( 0.271119)
100
- casecmp1-1 0.190000 0.000000 0.190000 ( 0.189462)
101
- casecmp2 1.540000 0.030000 1.570000 ( 1.104751)
102
- casecmp2-1 1.440000 0.030000 1.470000 ( 0.999689)
103
-
104
- rbx-head
105
-
106
- String#downcase == vs. String#casecmp
107
- Rehearsal ----------------------------------------------------
108
- String#downcase1 0.702746 0.005229 0.707975 ( 0.621969)
109
- String#downcase2 0.701429 0.001617 0.703046 ( 0.691833)
110
- String#downcase3 1.042835 0.002952 1.045787 ( 0.953992)
111
- casecmp1 0.654571 0.002239 0.656810 ( 0.480158)
112
- casecmp1-1 0.484706 0.001105 0.485811 ( 0.398601)
113
- casecmp2 0.564140 0.001579 0.565719 ( 0.545332)
114
- casecmp2-1 0.554889 0.001153 0.556042 ( 0.539569)
115
- ------------------------------------------- total: 4.721190sec
116
-
117
- user system total real
118
- String#downcase1 0.491199 0.001081 0.492280 ( 0.493727)
119
- String#downcase2 0.631059 0.001018 0.632077 ( 0.629885)
120
- String#downcase3 0.968867 0.002504 0.971371 ( 0.976734)
121
- casecmp1 0.364496 0.000434 0.364930 ( 0.365262)
122
- casecmp1-1 0.373140 0.000562 0.373702 ( 0.374136)
123
- casecmp2 0.487644 0.001057 0.488701 ( 0.490302)
124
- casecmp2-1 0.469868 0.001178 0.471046 ( 0.472220)
125
-
126
- ruby-1.8.7-p330
127
-
128
- String#downcase == vs. String#casecmp
129
- Rehearsal ----------------------------------------------------
130
- String#downcase1 0.780000 0.000000 0.780000 ( 0.783979)
131
- String#downcase2 0.950000 0.000000 0.950000 ( 0.954109)
132
- String#downcase3 0.960000 0.000000 0.960000 ( 0.960554)
133
- casecmp1 0.440000 0.000000 0.440000 ( 0.442546)
134
- casecmp1-1 0.490000 0.000000 0.490000 ( 0.487795)
135
- casecmp2 0.530000 0.000000 0.530000 ( 0.535819)
136
- casecmp2-1 0.570000 0.000000 0.570000 ( 0.574653)
137
- ------------------------------------------- total: 4.720000sec
138
-
139
- user system total real
140
- String#downcase1 0.780000 0.000000 0.780000 ( 0.780692)
141
- String#downcase2 0.980000 0.010000 0.990000 ( 0.982925)
142
- String#downcase3 0.960000 0.000000 0.960000 ( 0.961501)
143
- casecmp1 0.440000 0.000000 0.440000 ( 0.444528)
144
- casecmp1-1 0.490000 0.000000 0.490000 ( 0.487437)
145
- casecmp2 0.540000 0.000000 0.540000 ( 0.537686)
146
- casecmp2-1 0.570000 0.000000 0.570000 ( 0.574253)
147
-
148
- ruby-1.9.2-p136
149
-
150
- String#downcase == vs. String#casecmp
151
- Rehearsal ----------------------------------------------------
152
- String#downcase1 0.750000 0.000000 0.750000 ( 0.750523)
153
- String#downcase2 1.190000 0.000000 1.190000 ( 1.193346)
154
- String#downcase3 1.030000 0.010000 1.040000 ( 1.036435)
155
- casecmp1 0.640000 0.000000 0.640000 ( 0.640327)
156
- casecmp1-1 0.480000 0.000000 0.480000 ( 0.484709) # With all this crap running, some flukes pop out
157
- casecmp2 0.820000 0.000000 0.820000 ( 0.822223)
158
- casecmp2-1 0.660000 0.000000 0.660000 ( 0.664190)
159
- ------------------------------------------- total: 5.580000sec
160
-
161
- user system total real
162
- String#downcase1 0.760000 0.000000 0.760000 ( 0.759816)
163
- String#downcase2 1.150000 0.010000 1.160000 ( 1.150792)
164
- String#downcase3 1.000000 0.000000 1.000000 ( 1.005549)
165
- casecmp1 0.650000 0.000000 0.650000 ( 0.644021)
166
- casecmp1-1 0.490000 0.000000 0.490000 ( 0.494456)
167
- casecmp2 0.820000 0.000000 0.820000 ( 0.817689)
168
- casecmp2-1 0.680000 0.000000 0.680000 ( 0.685121)
169
- =end
data/benchmarks/excon.rb DELETED
@@ -1,69 +0,0 @@
1
- require 'rubygems' if RUBY_VERSION < '1.9'
2
- require 'bundler'
3
-
4
- Bundler.require(:default)
5
- Bundler.require(:benchmark)
6
-
7
- require 'sinatra/base'
8
-
9
- require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'excon')
10
-
11
- module Excon
12
- class Server < Sinatra::Base
13
-
14
- def self.run
15
- Rack::Handler::WEBrick.run(
16
- Excon::Server.new,
17
- :Port => 9292,
18
- :AccessLog => [],
19
- :Logger => WEBrick::Log.new(nil, WEBrick::Log::ERROR)
20
- )
21
- end
22
-
23
- get '/data/:amount' do |amount|
24
- 'x' * amount.to_i
25
- end
26
-
27
- end
28
- end
29
-
30
- def with_server(&block)
31
- pid = Process.fork do
32
- Excon::Server.run
33
- end
34
- loop do
35
- sleep(1)
36
- begin
37
- Excon.get('http://localhost:9292/api/foo')
38
- break
39
- rescue
40
- end
41
- end
42
- yield
43
- ensure
44
- Process.kill(9, pid)
45
- end
46
-
47
- require 'tach'
48
-
49
- size = 10_000
50
- path = '/data/' << size.to_s
51
- url = 'http://localhost:9292' << path
52
-
53
- times = 1_000
54
-
55
- with_server do
56
-
57
- Tach.meter(times) do
58
-
59
- tach('Excon') do
60
- Excon.get(url).body
61
- end
62
-
63
- excon = Excon.new(url)
64
- tach('Excon (persistent)') do
65
- excon.request(:method => 'get').body
66
- end
67
-
68
- end
69
- end