Permalink
Browse files

Add NullStream; use it for MsgPack benchmarking.

  • Loading branch information...
1 parent 5ee6e94 commit d97757fe471d6571483edd18946751d52bf586ec @pgriess committed Aug 24, 2010
Showing with 11 additions and 2 deletions.
  1. +2 −2 examples/msgpack/bench.js
  2. +9 −0 test/util.js
@@ -71,10 +71,10 @@ var TYPE_CBS = [
// pack
(function() {
- var b = new Buffer(1024);
+ var s = new util.NullStream();
return function() {
- strtokMsgpack.packBuf(b, 0, OBJ_TEMPLATE);
+ strtokMsgpack.packStream(s, OBJ_TEMPLATE);
};
})(),
View
@@ -90,6 +90,15 @@ var SinkStream = function(bufSz) {
};
exports.SinkStream = SinkStream;
+var NullStream = function() {
+ var self = this;
+
+ self.write = function() {
+ return true;
+ };
+};
+exports.NullStream = NullStream;
+
// Run the given stream (or string, coverted into a SourceStream) through
// strtok,parse() and verify types that come back using the given state
// table.

0 comments on commit d97757f

Please sign in to comment.