Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2016-01-26 02:00:06 +0300
committerJames M Snell <jasnell@gmail.com>2016-03-16 18:34:02 +0300
commit85ab4a5f1281c4e1dd06450ac7bd3250326267fa (patch)
tree7a51edfc5d6efc231cf821d575c9ca4a26d0545f /benchmark/dgram
parent90a5fc20be22b4278a01bc58acba0cb732da0140 (diff)
buffer: add .from(), .alloc() and .allocUnsafe()
Several changes: * Soft-Deprecate Buffer() constructors * Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()` * Add `--zero-fill-buffers` command line option * Add byteOffset and length to `new Buffer(arrayBuffer)` constructor * buffer.fill('') previously had no effect, now zero-fills * Update the docs PR-URL: https://github.com/nodejs/node/pull/4682 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Diffstat (limited to 'benchmark/dgram')
-rw-r--r--benchmark/dgram/array-vs-concat.js2
-rw-r--r--benchmark/dgram/multi-buffer.js2
-rw-r--r--benchmark/dgram/offset-length.js2
-rw-r--r--benchmark/dgram/single-buffer.js2
4 files changed, 4 insertions, 4 deletions
diff --git a/benchmark/dgram/array-vs-concat.js b/benchmark/dgram/array-vs-concat.js
index ee74ff66b92..e47229811e8 100644
--- a/benchmark/dgram/array-vs-concat.js
+++ b/benchmark/dgram/array-vs-concat.js
@@ -31,7 +31,7 @@ function main(conf) {
chunk = [];
for (var i = 0; i < chunks; i++) {
- chunk.push(new Buffer(Math.round(len / chunks)));
+ chunk.push(Buffer.allocUnsafe(Math.round(len / chunks)));
}
server();
diff --git a/benchmark/dgram/multi-buffer.js b/benchmark/dgram/multi-buffer.js
index 22c30594196..e7292feb1f9 100644
--- a/benchmark/dgram/multi-buffer.js
+++ b/benchmark/dgram/multi-buffer.js
@@ -31,7 +31,7 @@ function main(conf) {
chunk = [];
for (var i = 0; i < chunks; i++) {
- chunk.push(new Buffer(Math.round(len / chunks)));
+ chunk.push(Buffer.allocUnsafe(Math.round(len / chunks)));
}
server();
diff --git a/benchmark/dgram/offset-length.js b/benchmark/dgram/offset-length.js
index c11c465f5cf..15d9a3d0ee9 100644
--- a/benchmark/dgram/offset-length.js
+++ b/benchmark/dgram/offset-length.js
@@ -25,7 +25,7 @@ function main(conf) {
len = +conf.len;
num = +conf.num;
type = conf.type;
- chunk = new Buffer(len);
+ chunk = Buffer.allocUnsafe(len);
server();
}
diff --git a/benchmark/dgram/single-buffer.js b/benchmark/dgram/single-buffer.js
index 765311a72f3..2676e0e74cf 100644
--- a/benchmark/dgram/single-buffer.js
+++ b/benchmark/dgram/single-buffer.js
@@ -25,7 +25,7 @@ function main(conf) {
len = +conf.len;
num = +conf.num;
type = conf.type;
- chunk = new Buffer(len);
+ chunk = Buffer.allocUnsafe(len);
server();
}