Skip to content

Commit

Permalink
fix write-random.js, use leveldown instead of lmdb
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed Apr 27, 2015
1 parent 03fbbfb commit ca91015
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
6 changes: 1 addition & 5 deletions bench/write-random.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const leveldown = require('../../lmdb/')
const leveldown = require('../')
, crypto = require('crypto')
, fs = require('fs')
, du = require('du')
Expand Down Expand Up @@ -31,15 +31,12 @@ db.open(function (err) {
var inProgress = 0
, totalWrites = 0
, startTime = Date.now()
//, timesTotal = 0
, writeBuf = ''

function write() {
if (totalWrites % 100000 == 0) console.log(inProgress, totalWrites)

if (totalWrites % 1000 == 0) {
//timesStream.write((Date.now() - startTime) + ',' + Math.floor(timesTotal / 1000) + '\n')
//timesTotal = 0
timesStream.write(writeBuf)
writeBuf = ''
}
Expand All @@ -56,7 +53,6 @@ db.open(function (err) {
db.put(uuid.v4(), data, function (err) {
if (err)
throw err
//timesTotal += process.hrtime(time)[1]
writeBuf += (Date.now() - startTime) + ',' + process.hrtime(time)[1] + '\n'
inProgress--
process.nextTick(write)
Expand Down
6 changes: 1 addition & 5 deletions bench/write-sorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ db.open({ errorIfExists: true, createIfMissing: true }, function (err) {
var inProgress = 0
, totalWrites = 0
, startTime = Date.now()
//, timesTotal = 0
, writeBuf = ''

function write() {
if (totalWrites % 100000 == 0) console.log(inProgress, totalWrites)

if (totalWrites % 1000 == 0) {
//timesStream.write((Date.now() - startTime) + ',' + Math.floor(timesTotal / 1000) + '\n')
//timesTotal = 0
timesStream.write(writeBuf)
writeBuf = ''
}
Expand All @@ -56,7 +53,6 @@ db.open({ errorIfExists: true, createIfMissing: true }, function (err) {
db.put(timestamp(), data, function (err) {
if (err)
throw err
//timesTotal += process.hrtime(time)[1]
writeBuf += (Date.now() - startTime) + ',' + process.hrtime(time)[1] + '\n'
inProgress--
process.nextTick(write)
Expand All @@ -66,4 +62,4 @@ db.open({ errorIfExists: true, createIfMissing: true }, function (err) {
}

write()
})
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"mkfiletree": "~0.0.1",
"monotonic-timestamp": "~0.0.8",
"node-gyp": "~1.0.1",
"node-uuid": "~1.4.3",
"optimist": "~0.6.1",
"readfiletree": "~0.0.1",
"rimraf": "~2.2.8",
Expand Down

0 comments on commit ca91015

Please sign in to comment.