amq-protocol 1.9.0 → 1.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ac3c4778d62f3a7f84cd1132c77de339a2e97c3
4
- data.tar.gz: 205cf9a34ea9addcfe2458e1dfcc9b6fe8a6c81c
3
+ metadata.gz: aa10f585162559fa1b74d9f406725745e96ac46b
4
+ data.tar.gz: 017657dbecc96437ca9f28887e73df4d76d9df97
5
5
  SHA512:
6
- metadata.gz: ed02a18089fc8e1f633716981a1d995cf5ad6eb8663bdfb794effc32351dea6d97b56cbcea01a413f65d1ace0a56f1853bbe0bcce10072587c9439eb60d748d2
7
- data.tar.gz: 0c2344d1e5919666c6b38934fe3f38817f117f117ed8606b6090c96e7e43c6e8afa556bbf4bf9e2e082e7bea75518ac5090f9d48d869525edb532fc67a95856e
6
+ metadata.gz: 96631cb9c63b31649c309c1686ff5b26321e847ff0994c2a1bc007d54caa56e3fbe936bca7f56c809b812cd91d34bc94a9d84af582bb3d109a2310e5199d86ca
7
+ data.tar.gz: e607e0fa90130e7e76847810ac100ba3de2692d20321f1e4e1601cda97bcd0e979aa62350ee1b1bd9a0ed0becac53882f0ce96bca45edec669507623a73c59a4
data/.gitignore CHANGED
@@ -3,6 +3,8 @@
3
3
  /.ruby-version
4
4
  tmp
5
5
  *.pyc
6
+ *.iml
7
+ .idea
6
8
  /vendor/bundle
7
9
  /vendor/amq-*
8
10
  /coverage
@@ -13,3 +15,4 @@ Gemfile.lock
13
15
  bin/*
14
16
  *.bundle
15
17
  Makefile
18
+ profiling/dumps/*
data/.travis.yml CHANGED
@@ -4,9 +4,8 @@ script: "bundle exec rspec spec"
4
4
  rvm:
5
5
  - 2.0
6
6
  - 1.9.3
7
- - jruby-19mode
7
+ - jruby
8
8
  - 1.9.2
9
- - rbx-2.2.0
10
9
  - ruby-head
11
10
  - 1.8.7
12
11
  notifications:
data/README.md CHANGED
@@ -56,3 +56,7 @@ Any questions you may have should be sent to the [Ruby AMQP mailing list](http:/
56
56
  ## License
57
57
 
58
58
  MIT (see LICENSE in the repository root).
59
+
60
+
61
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ruby-amqp/amq-protocol/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
62
+
data/lib/amq/pack.rb CHANGED
@@ -7,7 +7,8 @@ module AMQ
7
7
  # compatible with Ruby 1.8+.
8
8
  module Pack
9
9
  UINT64 = "Q".freeze
10
- INT16 = "c".freeze
10
+ UINT16_BE = "n".freeze
11
+ INT16 = "c".freeze
11
12
 
12
13
  if Endianness.big_endian?
13
14
  def self.pack_uint64_big_endian(long_long)
@@ -42,8 +43,8 @@ module AMQ
42
43
  end
43
44
 
44
45
  def self.unpack_int16_big_endian(data)
45
- data = data.bytes.to_a.reverse.map(&:chr).join
46
- data.unpack(INT16)
46
+ value = data.bytes.to_a.map(&:chr).join.unpack(UINT16_BE)[0]
47
+ [(value & ~(1 << 15)) - (value & (1 << 15))]
47
48
  end
48
49
  end
49
50
  end
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Protocol
3
- VERSION = "1.9.0"
3
+ VERSION = "1.9.1"
4
4
  end # Protocol
5
5
  end # AMQ
@@ -0,0 +1,9 @@
1
+ # Profiling Scripts
2
+
3
+ This directory contains profiling scripts. Currently they use [stackprof](https://github.com/tmm1/stackprof) which
4
+ requires Ruby 2.1+ (preview2 or later).
5
+
6
+ ## Running the Profiler
7
+
8
+ ruby profiling/stackprof/body_framing_with_2k_payload.rb
9
+ stackprof profiling/dumps/body_framing_with_2k_payload.dump --text
@@ -17,16 +17,17 @@ n = 250_000
17
17
  puts "Doing a warmup run..."
18
18
  15_000.times { AMQ::Protocol::Method.encode_body("ab" * 1024, 1, FRAME_SIZE) }
19
19
 
20
- require 'ruby-prof'
20
+ require 'stackprof'
21
21
 
22
22
  # preallocate
23
23
  ary = Array.new(n) { "ab" * 1024 }
24
24
 
25
25
  puts "Doing main run..."
26
- result = RubyProf.profile do
26
+ result = StackProf.run(mode: :wall) do
27
27
  n.times { |i| AMQ::Protocol::Method.encode_body(ary[i], 1, FRAME_SIZE) }
28
28
  end
29
29
 
30
- printer = RubyProf::FlatPrinter.new(result)
31
- printer.print(STDOUT, {})
30
+ File.open('./profiling/dumps/body_framing_with_2k_payload.dump', "w+") do |f|
31
+ f.write Marshal.dump(result)
32
+ end
32
33
 
@@ -4,7 +4,23 @@ require File.expand_path('../../spec_helper', __FILE__)
4
4
 
5
5
 
6
6
  module AMQ
7
- describe Hacks do
7
+ describe Pack do
8
+ context "16-bit big-endian packing / unpacking" do
9
+ let(:examples_16bit) {
10
+ {
11
+ 0x068D => "\x06\x8D" # 1677
12
+ }
13
+ }
14
+
15
+ it "unpacks signed integers from a string to a number" do
16
+ examples_16bit.each do |key, value|
17
+ described_class.unpack_int16_big_endian(value)[0].should == key
18
+ end
19
+ end
20
+ end
21
+
22
+
23
+
8
24
  context "64-bit big-endian packing / unpacking" do
9
25
  let(:examples) {
10
26
  {
@@ -181,8 +181,8 @@ module AMQ
181
181
  end
182
182
 
183
183
  it 'is capable of decoding 16bit signed integers' do
184
- output = TableValueDecoder.decode_short("\b\xC0",0).first
185
- output.should == -64
184
+ output = TableValueDecoder.decode_short("\x06\x8D", 0).first
185
+ output.should == 1677
186
186
  end
187
187
 
188
188
  it "is capable of decoding tables" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amq-protocol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Stastny
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-11-21 00:00:00.000000000 Z
14
+ date: 2013-12-18 00:00:00.000000000 Z
15
15
  dependencies: []
16
16
  description: |2
17
17
  amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an
@@ -61,10 +61,11 @@ files:
61
61
  - lib/amq/protocol/version.rb
62
62
  - lib/amq/settings.rb
63
63
  - lib/amq/uri.rb
64
- - profiling/pure/body_framing_with_2k_payload.rb
64
+ - profiling/README.md
65
+ - profiling/stackprof/body_framing_with_2k_payload.rb
65
66
  - spec/amq/bit_set_spec.rb
66
- - spec/amq/hacks_spec.rb
67
67
  - spec/amq/int_allocator_spec.rb
68
+ - spec/amq/pack_spec.rb
68
69
  - spec/amq/protocol/basic_spec.rb
69
70
  - spec/amq/protocol/blank_body_encoding_spec.rb
70
71
  - spec/amq/protocol/channel_spec.rb
@@ -103,8 +104,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  version: '0'
104
105
  requirements: []
105
106
  rubyforge_project: amq-protocol
106
- rubygems_version: 2.1.6
107
+ rubygems_version: 2.1.11
107
108
  signing_key:
108
109
  specification_version: 4
109
110
  summary: AMQP 0.9.1 encoder & decoder.
110
111
  test_files: []
112
+ has_rdoc: