Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Benchmark of bulk commit versus regular one-by-one serial commit of 1…

…000 documents.
  • Loading branch information...
commit 05217c279d772912b85f95f37ad7ca4d79e24916 1 parent a22cdea
@Bluebie authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 examples/benchmark.rb
View
18 examples/benchmark.rb
@@ -0,0 +1,18 @@
+require '../lib/chill'
+require 'benchmark'
+# A little benchmark to illustrate the performance difference between a bulk commit and individual commits
+ChillDB.goes :BulkCommitBenchmark
+Documents = 1000 # benchmark 1000 documents
+
+puts "Bulk Commit of #{Documents}"
+puts Benchmark.realtime {
+ BulkCommitBenchmark.commit! Documents.times.map { { random_number: rand(50) } }
+}
+
+puts "Single Commit of #{Documents}"
+puts Benchmark.realtime {
+ Documents.times do
+ { random_number: rand(50) }
+ BulkCommitBenchmark.document( random_number: rand(50) ).commit!
+ end
+}
Please sign in to comment.
Something went wrong with that request. Please try again.