excon 0.64.0 → 0.65.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of excon might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/data/cacert.pem +108 -2
- data/excon.gemspec +7 -2
- data/lib/excon.rb +11 -11
- data/lib/excon/connection.rb +25 -25
- data/lib/excon/response.rb +1 -1
- data/lib/excon/version.rb +1 -1
- metadata +3 -101
- data/.document +0 -5
- data/.github/stale.yml +0 -17
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/.travis.yml +0 -17
- data/Gemfile +0 -19
- data/Rakefile +0 -41
- data/benchmarks/class_vs_lambda.rb +0 -50
- data/benchmarks/concat_vs_insert.rb +0 -21
- data/benchmarks/concat_vs_interpolate.rb +0 -22
- data/benchmarks/cr_lf.rb +0 -21
- data/benchmarks/downcase-eq-eq_vs_casecmp.rb +0 -169
- data/benchmarks/excon.rb +0 -69
- data/benchmarks/excon_vs.rb +0 -165
- data/benchmarks/for_vs_array_each.rb +0 -27
- data/benchmarks/for_vs_hash_each.rb +0 -27
- data/benchmarks/has_key-vs-lookup.rb +0 -177
- data/benchmarks/headers_case_sensitivity.rb +0 -83
- data/benchmarks/headers_split_vs_match.rb +0 -34
- data/benchmarks/implicit_block-vs-explicit_block.rb +0 -98
- data/benchmarks/merging.rb +0 -21
- data/benchmarks/single_vs_double_quotes.rb +0 -21
- data/benchmarks/string_ranged_index.rb +0 -87
- data/benchmarks/strip_newline.rb +0 -115
- data/benchmarks/vs_stdlib.rb +0 -82
- data/changelog.txt +0 -1113
- data/spec/excon/error_spec.rb +0 -139
- data/spec/excon/test/server_spec.rb +0 -28
- data/spec/excon_spec.rb +0 -7
- data/spec/helpers/file_path_helpers.rb +0 -22
- data/spec/helpers/warning_helpers.rb +0 -9
- data/spec/requests/basic_spec.rb +0 -40
- data/spec/requests/eof_requests_spec.rb +0 -36
- data/spec/requests/unix_socket_spec.rb +0 -38
- data/spec/requests/validation_spec.rb +0 -80
- data/spec/spec_helper.rb +0 -26
- data/spec/support/shared_contexts/test_server_context.rb +0 -83
- data/spec/support/shared_contexts/test_stub_context.rb +0 -11
- data/spec/support/shared_examples/shared_example_for_clients.rb +0 -220
- data/spec/support/shared_examples/shared_example_for_streaming_clients.rb +0 -20
- data/spec/support/shared_examples/shared_example_for_test_servers.rb +0 -16
- data/tests/authorization_header_tests.rb +0 -27
- data/tests/bad_tests.rb +0 -69
- data/tests/basic_tests.rb +0 -351
- data/tests/batch_requests.rb +0 -133
- data/tests/complete_responses.rb +0 -31
- data/tests/data/127.0.0.1.cert.crt +0 -17
- data/tests/data/127.0.0.1.cert.key +0 -28
- data/tests/data/excon.cert.crt +0 -17
- data/tests/data/excon.cert.key +0 -28
- data/tests/data/xs +0 -1
- data/tests/error_tests.rb +0 -145
- data/tests/header_tests.rb +0 -119
- data/tests/instrumentors/logging_instrumentor_tests.rb +0 -28
- data/tests/middleware_tests.rb +0 -27
- data/tests/middlewares/canned_response_tests.rb +0 -34
- data/tests/middlewares/capture_cookies_tests.rb +0 -34
- data/tests/middlewares/decompress_tests.rb +0 -157
- data/tests/middlewares/escape_path_tests.rb +0 -36
- data/tests/middlewares/idempotent_tests.rb +0 -245
- data/tests/middlewares/instrumentation_tests.rb +0 -315
- data/tests/middlewares/mock_tests.rb +0 -304
- data/tests/middlewares/redirect_follower_tests.rb +0 -112
- data/tests/pipeline_tests.rb +0 -40
- data/tests/proxy_tests.rb +0 -306
- data/tests/query_string_tests.rb +0 -87
- data/tests/rackups/basic.rb +0 -41
- data/tests/rackups/basic.ru +0 -3
- data/tests/rackups/basic_auth.ru +0 -14
- data/tests/rackups/deflater.ru +0 -4
- data/tests/rackups/proxy.ru +0 -18
- data/tests/rackups/query_string.ru +0 -13
- data/tests/rackups/redirecting.ru +0 -23
- data/tests/rackups/redirecting_with_cookie.ru +0 -40
- data/tests/rackups/request_headers.ru +0 -15
- data/tests/rackups/request_methods.ru +0 -21
- data/tests/rackups/response_header.ru +0 -18
- data/tests/rackups/ssl.ru +0 -16
- data/tests/rackups/ssl_mismatched_cn.ru +0 -15
- data/tests/rackups/ssl_verify_peer.ru +0 -16
- data/tests/rackups/streaming.ru +0 -30
- data/tests/rackups/thread_safety.ru +0 -17
- data/tests/rackups/timeout.ru +0 -14
- data/tests/rackups/webrick_patch.rb +0 -34
- data/tests/request_headers_tests.rb +0 -21
- data/tests/request_method_tests.rb +0 -47
- data/tests/request_tests.rb +0 -58
- data/tests/response_tests.rb +0 -197
- data/tests/servers/bad.rb +0 -25
- data/tests/servers/eof.rb +0 -17
- data/tests/servers/error.rb +0 -20
- data/tests/servers/good.rb +0 -342
- data/tests/servers/good_ipv4.rb +0 -8
- data/tests/servers/good_ipv6.rb +0 -8
- data/tests/test_helper.rb +0 -297
- data/tests/thread_safety_tests.rb +0 -39
- data/tests/timeout_tests.rb +0 -12
- data/tests/utils_tests.rb +0 -81
data/.document
DELETED
data/.github/stale.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# Number of days of inactivity before an issue becomes stale
|
2
|
-
daysUntilStale: 60
|
3
|
-
# Number of days of inactivity before a stale issue is closed
|
4
|
-
daysUntilClose: 7
|
5
|
-
# Issues with these labels will never be considered stale
|
6
|
-
exemptLabels:
|
7
|
-
- pinned
|
8
|
-
- security
|
9
|
-
# Label to use when marking an issue as stale
|
10
|
-
staleLabel: wontfix
|
11
|
-
# Comment to post when marking an issue as stale. Set to `false` to disable
|
12
|
-
markComment: >
|
13
|
-
This issue has been automatically marked stale due to inactivity.
|
14
|
-
It will be closed if no further activity occurs.
|
15
|
-
Thank you for your contributions.
|
16
|
-
# Comment to post when closing a stale issue. Set to `false` to disable
|
17
|
-
closeComment: false
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
before_install:
|
2
|
-
- gem install bundler
|
3
|
-
before_script:
|
4
|
-
# enable ipv6 see: https://github.com/travis-ci/travis-ci/issues/8361#issuecomment-350497804
|
5
|
-
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
|
6
|
-
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6';
|
7
|
-
fi
|
8
|
-
language: ruby
|
9
|
-
rvm:
|
10
|
-
- 2.3
|
11
|
-
- 2.4
|
12
|
-
- 2.5
|
13
|
-
- 2.6
|
14
|
-
script:
|
15
|
-
- "bundle exec shindont"
|
16
|
-
- "bundle exec rake spec[progress]"
|
17
|
-
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
|