[Pkg-javascript-commits] [node-leveldown] 124/492: fix batch() benchmarks

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:51 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit 67d6796e4d0e60c347690e5010ef02533cc1bcc0
Author: Rod Vagg <rod at vagg.org>
Date:   Sun Dec 16 23:36:29 2012 +1100

    fix batch() benchmarks
---
 test/benchmarks/tests/batch_int_string_x1000_leveled.js |  5 ++---
 test/benchmarks/tests/batch_int_string_x1000_levelup.js | 14 ++++++--------
 test/benchmarks/tests/index.js                          |  7 +++----
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/test/benchmarks/tests/batch_int_string_x1000_leveled.js b/test/benchmarks/tests/batch_int_string_x1000_leveled.js
index 85e856b..2e98440 100644
--- a/test/benchmarks/tests/batch_int_string_x1000_leveled.js
+++ b/test/benchmarks/tests/batch_int_string_x1000_leveled.js
@@ -1,8 +1,7 @@
 var fn = function (puts, db, cb) {
-  var received = 0
-    , after = function (err) {
+  var after = function (err) {
         if (err) throw err
-        if (++received == puts) cb()
+        cb()
       }
     , batch = db.batch()
 
diff --git a/test/benchmarks/tests/batch_int_string_x1000_levelup.js b/test/benchmarks/tests/batch_int_string_x1000_levelup.js
index 80f401f..4f559ee 100644
--- a/test/benchmarks/tests/batch_int_string_x1000_levelup.js
+++ b/test/benchmarks/tests/batch_int_string_x1000_levelup.js
@@ -1,22 +1,20 @@
 var fn = function (puts, db, cb) {
-  var received = 0
-    , after = function (err) {
+  var after = function (err) {
         if (err) throw err
-        if (++received == puts) cb()
+        cb()
       }
+    , data = []
 
   if (this.cycle == null) this.cycle = 0
   else this.cycle++
 
   for (var i = 0; i < puts; i++)
-    db.batch(
-        [{
+    data.push({
             type: 'put'
           , key: this.cycle * puts + i
           , value: "It'll be top end no worries stands out like a bushie. It'll be cream no dramas flat out like a rotten. As busy as a slabs bloody built like a stonkered. Get a dog up ya oldies no dramas lets get some bottle-o. Built like a schooner as busy as a big smoke. You little ripper ute my you little ripper dag."
-        }]
-      , after
-    )
+        })
+  db.batch(data, after)
 }
 
 module.exports = fn.bind(null, 1000)
diff --git a/test/benchmarks/tests/index.js b/test/benchmarks/tests/index.js
index 245706e..1bfc45c 100644
--- a/test/benchmarks/tests/index.js
+++ b/test/benchmarks/tests/index.js
@@ -43,18 +43,17 @@ module.exports = {
       , 'SQLite3'             : require('./get_int_string_x1000_sqlite3')
     }
 
-  , 'batch(int, string) x 1000': {
+  , '=>batch(int, string) x 1000': {
         'LevelUP'             : require('./batch_int_string_x1000_levelup')
       , 'LevelUP (release)'   : require('./batch_int_string_x1000_levelup')
       , 'LevelUP (no Snappy)' : require('./batch_int_string_x1000_levelup')
-// Leveled is currently killing the process for these batch ops
-//      , 'Leveled'             : require('./batch_int_string_x1000_leveled')
+      , 'Leveled'             : require('./batch_int_string_x1000_leveled')
     }
 
   , 'batch(int, string) x 100,000': {
         'LevelUP'             : require('./batch_int_string_x100000_levelup')
       , 'LevelUP (release)'   : require('./batch_int_string_x100000_levelup')
       , 'LevelUP (no Snappy)' : require('./batch_int_string_x100000_levelup')
-//      , 'Leveled'             : require('./batch_int_string_x100000_leveled')
+      , 'Leveled'             : require('./batch_int_string_x100000_leveled')
     }
 }
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list