[Pkg-javascript-commits] [node-leveldown] 82/492: single-put batch benchmark

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:47 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 487d614d1f9e6d772b0ebce8a804e83ed5ea2464
Author: Rod Vagg <rod at vagg.org>
Date:   Tue Nov 20 14:00:05 2012 +1100

    single-put batch benchmark
---
 test/benchmarks/benchmarks.js | 48 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/test/benchmarks/benchmarks.js b/test/benchmarks/benchmarks.js
index d5ad40f..773fcaf 100644
--- a/test/benchmarks/benchmarks.js
+++ b/test/benchmarks/benchmarks.js
@@ -59,6 +59,54 @@ module.exports = {
         )
     }
 
+    // Single put as batch() operation, 1000 objects at a time
+
+  , 'LevelUP#batch({put, int, string}) x 1000': function (db, cb) {
+      var puts = 1000
+        , received = 0
+        , after = function (err) {
+            if (err) throw err
+            if (++received == puts) cb()
+          }
+
+      if (this.cycle == null) this.cycle = 0
+      else this.cycle++
+
+      for (var i = 0; i < puts; i++)
+        db.batch(
+            [{
+                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
+        )
+    }
+
+    // Single put as batch() operation, 1000 objects at a time
+
+  , 'LevelUP#batch({put, int, string}) x 100,000': function (db, cb) {
+      var puts = 100000
+        , received = 0
+        , after = function (err) {
+            if (err) throw err
+            if (++received == puts) cb()
+          }
+
+      if (this.cycle == null) this.cycle = 0
+      else this.cycle++
+
+      for (var i = 0; i < puts; i++)
+        db.batch(
+            [{
+                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
+        )
+    }
+
   , 'LevelUP#get(int) x 1000': {
         'setup': function (db, cb) {
           var count = 1000

-- 
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