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 +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +1 -2
- data/README.md +4 -0
- data/lib/amq/pack.rb +4 -3
- data/lib/amq/protocol/version.rb +1 -1
- data/profiling/README.md +9 -0
- data/profiling/{pure → stackprof}/body_framing_with_2k_payload.rb +5 -4
- data/spec/amq/{hacks_spec.rb → pack_spec.rb} +17 -1
- data/spec/amq/protocol/table_spec.rb +2 -2
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa10f585162559fa1b74d9f406725745e96ac46b
|
4
|
+
data.tar.gz: 017657dbecc96437ca9f28887e73df4d76d9df97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96631cb9c63b31649c309c1686ff5b26321e847ff0994c2a1bc007d54caa56e3fbe936bca7f56c809b812cd91d34bc94a9d84af582bb3d109a2310e5199d86ca
|
7
|
+
data.tar.gz: e607e0fa90130e7e76847810ac100ba3de2692d20321f1e4e1601cda97bcd0e979aa62350ee1b1bd9a0ed0becac53882f0ce96bca45edec669507623a73c59a4
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
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
|
+
[](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
|
-
|
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
|
-
|
46
|
-
|
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
|
data/lib/amq/protocol/version.rb
CHANGED
data/profiling/README.md
ADDED
@@ -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 '
|
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 =
|
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
|
-
|
31
|
-
|
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
|
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("\
|
185
|
-
output.should ==
|
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.
|
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-
|
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/
|
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.
|
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:
|