omq 0.17.6 → 0.17.7
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/CHANGELOG.md +15 -0
- data/lib/omq/routing/round_robin.rb +1 -4
- data/lib/omq/version.rb +1 -1
- data/lib/omq/writable.rb +11 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73eab426d02fba35d577d6f67aca5b45aeaa3ef6a58f0e8e74734d6c53fb52ff
|
|
4
|
+
data.tar.gz: 1a4fa1e02054ee0b4f5db6e1bd2bfdf19bf88d0fb7041455d564a2b4805da95b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8bad71e0d237ee593f42fddb21b6d2fd8d921829ae5f117b7a39ccbaf56e297b11a4341680035e6ba6daaa61aa8cfbcc099e5ff7f5d04ad8f2dda23c9cf9ce56
|
|
7
|
+
data.tar.gz: da4b0609aa0cbf5cb3416bc53e75a9e14196d65a4ffc652eb13f25ab0a9ca81ce2ec3ef06367f1eb658681607b68e67e03db3b608672a1790fa5cf7ee8d37f62
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.7 — 2026-04-10
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **Message parts coerced via `#to_s`.** `#frozen_binary` now calls
|
|
8
|
+
`#to_s` instead of `#to_str`, so `nil` becomes an empty frame and
|
|
9
|
+
integers/symbols are converted automatically. A cached `EMPTY_PART`
|
|
10
|
+
avoids allocations for nil parts.
|
|
11
|
+
|
|
12
|
+
- **Reduced allocations on hot paths.** `freeze_message` short-circuits
|
|
13
|
+
when all parts are already frozen binary (zero-alloc fast path).
|
|
14
|
+
`write_batch` passes the batch directly instead of `.map`-ing through
|
|
15
|
+
`transform_send` — only REQ overrides the transform and it never
|
|
16
|
+
batches. Up to +55% throughput on small messages (PUSH/PULL IPC 64B).
|
|
17
|
+
|
|
3
18
|
## 0.17.6 — 2026-04-10
|
|
4
19
|
|
|
5
20
|
### Fixed
|
|
@@ -154,10 +154,7 @@ module OMQ
|
|
|
154
154
|
if batch.size == 1
|
|
155
155
|
conn.send_message(transform_send(batch[0]))
|
|
156
156
|
else
|
|
157
|
-
|
|
158
|
-
# BATCH_MSG_CAP messages). transform_send is identity for
|
|
159
|
-
# most routings and only allocates a new parts array for REQ.
|
|
160
|
-
conn.write_messages(batch.map { |parts| transform_send(parts) })
|
|
157
|
+
conn.write_messages(batch)
|
|
161
158
|
conn.flush
|
|
162
159
|
end
|
|
163
160
|
end
|
data/lib/omq/version.rb
CHANGED
data/lib/omq/writable.rb
CHANGED
|
@@ -39,17 +39,25 @@ module OMQ
|
|
|
39
39
|
def freeze_message(message)
|
|
40
40
|
parts = message.is_a?(Array) ? message : [message]
|
|
41
41
|
raise ArgumentError, "message has no parts" if parts.empty?
|
|
42
|
+
|
|
43
|
+
# Fast path: skip map when all parts are already frozen binary.
|
|
42
44
|
if parts.frozen?
|
|
45
|
+
return parts if parts.all? { |p| p.is_a?(String) && p.frozen? && p.encoding == Encoding::BINARY }
|
|
43
46
|
parts = parts.map { |p| frozen_binary(p) }
|
|
44
47
|
else
|
|
45
|
-
parts.
|
|
48
|
+
unless parts.all? { |p| p.is_a?(String) && p.frozen? && p.encoding == Encoding::BINARY }
|
|
49
|
+
parts.map! { |p| frozen_binary(p) }
|
|
50
|
+
end
|
|
46
51
|
end
|
|
47
52
|
parts.freeze
|
|
48
53
|
end
|
|
49
54
|
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
EMPTY_PART = "".b.freeze
|
|
57
|
+
|
|
58
|
+
def frozen_binary(obj)
|
|
59
|
+
return EMPTY_PART if obj.nil?
|
|
60
|
+
s = obj.to_s
|
|
53
61
|
return s if s.frozen? && s.encoding == Encoding::BINARY
|
|
54
62
|
s.b.freeze
|
|
55
63
|
end
|