pico_http_parser 0.0.1 → 0.0.2

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: ad1b28654ae822de80dd8cafb209f4fb302b639e
4
- data.tar.gz: dd9532af2d95f15e40298b9f876bf9f3fb543bd6
3
+ metadata.gz: 77d9ce494785aca207b88dd3bdc5340d94cac9ad
4
+ data.tar.gz: 9ee980d7dd5d1c5f5c2467603dffc0444513fb71
5
5
  SHA512:
6
- metadata.gz: f2e8374bf76d7193501fb5d2e9216c4603c199ab8000546392aee6529325a7b15fee09cbaa96534306bc680c1a1fe4d97c4408ad100d79b38497e87f504d048c
7
- data.tar.gz: fa3ca50a01a91d7c82aee8774d96d9c5b734b99798296f794be74799b8afd9854b46beb3eab78241fbcc4b8cb17340ef6eac7236f920709670848d68681d1ebf
6
+ metadata.gz: 7fb958f767c35d5d71234f729ad74e346685329072122b612766787ff000e4ff21c2d12b42b5e73f6096ed63682f570b56fb7ae9f1defed42b8c1fb87d9935d5
7
+ data.tar.gz: 7dfa7423fda76a94ea59df99a0e6d15b59ba61620d3e4575269508a1a3411de1e064bb0b0d99bd7d03f2e95f02e65eb0c45783cbf8c24ac570f8f3ae3d118cf7
data/README.md CHANGED
@@ -49,6 +49,23 @@ given request is corrupt
49
49
 
50
50
  given request is incomplete
51
51
 
52
+ ## Benchmark
53
+
54
+ On my Macbook Air
55
+
56
+ ```
57
+ Calculating -------------------------------------
58
+ PicoHTTPParser 13.988k i/100ms
59
+ Unicorn's HttpParser 12.250k i/100ms
60
+ -------------------------------------------------
61
+ PicoHTTPParser 160.563k (± 4.3%) i/s - 811.304k
62
+ Unicorn's HttpParser 135.976k (± 4.1%) i/s - 686.000k
63
+
64
+ Comparison:
65
+ PicoHTTPParser: 160562.7 i/s
66
+ Unicorn's HttpParser: 135975.8 i/s - 1.18x slower
67
+ ```
68
+
52
69
  ## SEE ALSO
53
70
 
54
71
  PicoHTTPParser is created based on Perl's HTTP::Parser::XS.
@@ -61,7 +78,7 @@ https://github.com/h2o/picohttpparser
61
78
 
62
79
  ## Contributing
63
80
 
64
- 1. Fork it ( https://github.com/[my-github-username]/pico_http_parser/fork )
81
+ 1. Fork it ( https://github.com/kazeburo/pico_http_parser/fork )
65
82
  2. Create your feature branch (`git checkout -b my-new-feature`)
66
83
  3. Commit your changes (`git commit -am 'Add some feature'`)
67
84
  4. Push to the branch (`git push origin my-new-feature`)
@@ -2,4 +2,4 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
 
4
4
  require 'rubygems'
5
- require 'benchmark'
5
+ require 'benchmark/ips'
@@ -12,24 +12,26 @@ loop = 300000
12
12
 
13
13
  #File.read(File.expand_path(File.dirname(__FILE__) + '/sample_request.http'))
14
14
 
15
- Benchmark.bmbm(20) do |bm|
16
- bm.report("PicoHTTPParser") do
17
- 0.upto(loop) do
18
- env = {}
19
- PicoHTTPParser.parse_http_request(request_body,env)
20
- end
21
- end
15
+ Benchmark.ips do |x|
16
+ x.time = 5
17
+ x.warmup = 2
18
+
19
+ x.report("PicoHTTPParser") {
20
+ env = {}
21
+ PicoHTTPParser.parse_http_request(request_body,env)
22
+ }
23
+
22
24
  begin
23
25
  require 'unicorn'
24
26
  include Unicorn
25
- bm.report("HttpParser") do
26
- 0.upto(loop) do
27
- parser = HttpParser.new
28
- parser.buf << request_body
29
- parser.parse
30
- end
31
- end
27
+ x.report("Unicorn's HttpParser") {
28
+ parser = HttpParser.new
29
+ parser.buf << request_body
30
+ parser.parse
31
+ }
32
32
  rescue LoadError
33
33
  puts("Can't benchmark unicorn as it couldn't be loaded.")
34
34
  end
35
+
36
+ x.compare!
35
37
  end
@@ -1,3 +1,3 @@
1
1
  class PicoHTTPParser
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = PicoHTTPParser::VERSION
9
9
  spec.authors = ["Masahiro Nagano"]
10
10
  spec.email = ["kazeburo@gmail.com"]
11
- spec.summary = %q{Fast HTTP parser using picohttparser}
12
- spec.description = %q{Fast HTTP parser using picohttparser}
11
+ spec.summary = %q{Fast HTTP parser using picohttpparser}
12
+ spec.description = %q{Fast HTTP parser using picohttpparser}
13
13
  spec.homepage = "https://github.com/kazeburo/pico_http_parser"
14
14
  spec.license = "Artistic"
15
15
  spec.extensions = %w[ext/pico_http_parser/extconf.rb]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pico_http_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nagano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3'
55
- description: Fast HTTP parser using picohttparser
55
+ description: Fast HTTP parser using picohttpparser
56
56
  email:
57
57
  - kazeburo@gmail.com
58
58
  executables: []
@@ -68,7 +68,7 @@ files:
68
68
  - README.md
69
69
  - Rakefile
70
70
  - benchmark/bench_helper.rb
71
- - benchmark/benchmark.pl
71
+ - benchmark/benchmark.rb
72
72
  - ext/pico_http_parser/extconf.rb
73
73
  - ext/pico_http_parser/pico_http_parser.c
74
74
  - ext/pico_http_parser/picohttpparser/.gitattributes
@@ -109,7 +109,7 @@ rubyforge_project:
109
109
  rubygems_version: 2.2.2
110
110
  signing_key:
111
111
  specification_version: 4
112
- summary: Fast HTTP parser using picohttparser
112
+ summary: Fast HTTP parser using picohttpparser
113
113
  test_files:
114
114
  - spec/01_simple_spec.rb
115
115
  - spec/02_too_much_spec.rb