Browse Source

benchmark: update callbacks only receive data

Since the SlabAllocator was removed the buffer length/offset is no
longer sent to the onread callback. The benchmarks have been updated to
reflect that.
Trevor Norris 12 years ago
parent
commit
22668db73d
  1. 5
      benchmark/net/tcp-raw-c2s.js
  2. 9
      benchmark/net/tcp-raw-pipe.js
  3. 5
      benchmark/net/tcp-raw-s2c.js

5
benchmark/net/tcp-raw-c2s.js

@ -57,7 +57,7 @@ function server() {
bench.end((bytes * 8) / (1024 * 1024 * 1024)); bench.end((bytes * 8) / (1024 * 1024 * 1024));
}, dur * 1000); }, dur * 1000);
clientHandle.onread = function(buffer, offset, length) { clientHandle.onread = function(buffer) {
// we're not expecting to ever get an EOF from the client. // we're not expecting to ever get an EOF from the client.
// just lots of data forever. // just lots of data forever.
if (!buffer) if (!buffer)
@ -65,8 +65,7 @@ function server() {
// don't slice the buffer. the point of this is to isolate, not // don't slice the buffer. the point of this is to isolate, not
// simulate real traffic. // simulate real traffic.
// var chunk = buffer.slice(offset, offset + length); bytes += buffer.length;
bytes += length;
}; };
clientHandle.readStart(); clientHandle.readStart();

9
benchmark/net/tcp-raw-pipe.js

@ -48,14 +48,13 @@ function server() {
if (!clientHandle) if (!clientHandle)
fail('connect'); fail('connect');
clientHandle.onread = function(buffer, offset, length) { clientHandle.onread = function(buffer) {
// we're not expecting to ever get an EOF from the client. // we're not expecting to ever get an EOF from the client.
// just lots of data forever. // just lots of data forever.
if (!buffer) if (!buffer)
fail('read'); fail('read');
var chunk = buffer.slice(offset, offset + length); var writeReq = clientHandle.writeBuffer(buffer);
var writeReq = clientHandle.writeBuffer(chunk);
if (!writeReq) if (!writeReq)
fail('write'); fail('write');
@ -99,11 +98,11 @@ function client() {
clientHandle.readStart(); clientHandle.readStart();
clientHandle.onread = function(buffer, start, length) { clientHandle.onread = function(buffer) {
if (!buffer) if (!buffer)
fail('read'); fail('read');
bytes += length; bytes += buffer.length;
}; };
connectReq.oncomplete = function() { connectReq.oncomplete = function() {

5
benchmark/net/tcp-raw-s2c.js

@ -111,7 +111,7 @@ function client() {
connectReq.oncomplete = function() { connectReq.oncomplete = function() {
var bytes = 0; var bytes = 0;
clientHandle.onread = function(buffer, offset, length) { clientHandle.onread = function(buffer) {
// we're not expecting to ever get an EOF from the client. // we're not expecting to ever get an EOF from the client.
// just lots of data forever. // just lots of data forever.
if (!buffer) if (!buffer)
@ -119,8 +119,7 @@ function client() {
// don't slice the buffer. the point of this is to isolate, not // don't slice the buffer. the point of this is to isolate, not
// simulate real traffic. // simulate real traffic.
// var chunk = buffer.slice(offset, offset + length); bytes += buffer.length;
bytes += length;
}; };
clientHandle.readStart(); clientHandle.readStart();

Loading…
Cancel
Save