amqplib 0.10.1 → 0.10.2
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.
- package/CHANGELOG.md +8 -0
- package/lib/connection.js +10 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change log for amqplib
|
|
2
2
|
|
|
3
|
+
## Changes in v0.10.2
|
|
4
|
+
|
|
5
|
+
git log v0.10.1..v0.10.2
|
|
6
|
+
|
|
7
|
+
- Use Buffer.allocUnsafe when sending messages to improve performance ([PR
|
|
8
|
+
695](https://github.com/amqp-node/amqplib/pull/695), thank you
|
|
9
|
+
@chkimes and @Uzlopak)
|
|
10
|
+
|
|
3
11
|
## Changes in v0.10.1
|
|
4
12
|
|
|
5
13
|
git log v0.10.0..v0.10.1
|
package/lib/connection.js
CHANGED
|
@@ -560,7 +560,11 @@ C.sendMessage = function(channel,
|
|
|
560
560
|
var allLen = methodHeaderLen + bodyLen;
|
|
561
561
|
|
|
562
562
|
if (allLen < SINGLE_CHUNK_THRESHOLD) {
|
|
563
|
-
|
|
563
|
+
// Use `allocUnsafe` to avoid excessive allocations and CPU usage
|
|
564
|
+
// from zeroing. The returned Buffer is not zeroed and so must be
|
|
565
|
+
// completely filled to be used safely.
|
|
566
|
+
// See https://github.com/amqp-node/amqplib/pull/695
|
|
567
|
+
var all = Buffer.allocUnsafe(allLen);
|
|
564
568
|
var offset = mframe.copy(all, 0);
|
|
565
569
|
offset += pframe.copy(all, offset);
|
|
566
570
|
|
|
@@ -570,7 +574,11 @@ C.sendMessage = function(channel,
|
|
|
570
574
|
}
|
|
571
575
|
else {
|
|
572
576
|
if (methodHeaderLen < SINGLE_CHUNK_THRESHOLD) {
|
|
573
|
-
|
|
577
|
+
// Use `allocUnsafe` to avoid excessive allocations and CPU usage
|
|
578
|
+
// from zeroing. The returned Buffer is not zeroed and so must be
|
|
579
|
+
// completely filled to be used safely.
|
|
580
|
+
// See https://github.com/amqp-node/amqplib/pull/695
|
|
581
|
+
var both = Buffer.allocUnsafe(methodHeaderLen);
|
|
574
582
|
var offset = mframe.copy(both, 0);
|
|
575
583
|
pframe.copy(both, offset);
|
|
576
584
|
buffer.write(both);
|
package/package.json
CHANGED