Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Jul 18, 2011
1 parent 98f3482 commit 5925000
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion benchmark/bson_benchmark.js
Expand Up @@ -9,7 +9,7 @@ var ObjectID = require('../lib/mongodb').BSONPure.ObjectID;
// require('util').debug(require('util').inspect(BSON))

var COUNT = 10000;
// var COUNT = 1;
var COUNT = 1;
// var object = {
// string: "Strings are great",
// decimal: 3.14159265,
Expand Down Expand Up @@ -52,6 +52,7 @@ end = new Date
console.log("bson size (bytes): ", objectBSON.length)
console.log("time = ", end - start, "ms -", COUNT * 1000 / (end - start), " ops/sec")

var COUNT = 10000;

// console.log(COUNT + "x (objectJSON = JSON.stringify(object))")
// start = new Date
Expand Down
7 changes: 4 additions & 3 deletions lib/mongodb/bson/bson.js
Expand Up @@ -1463,11 +1463,12 @@ BSON.deserialize = function(data) {
var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24;
// Ajust index
index = index + 4;
// Data length
var dataLength = data.length;

while(index < data.length) {
while(index < dataLength) {
// Read the first byte indicating the type of object
var type = data[index];

var type = data[index];
// Adjust for the type of element
index = index + 1;

Expand Down

0 comments on commit 5925000

Please sign in to comment.