Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adds benchmarks

  • Loading branch information...
commit dc74f8d49483871fd92d6624770d45ec636002c1 1 parent 900f8f5
@sintaxi sintaxi authored
Showing with 66 additions and 0 deletions.
  1. +25 −0 benchmark/find.js
  2. +22 −0 benchmark/read.js
  3. +19 −0 benchmark/write.js
View
25 benchmark/find.js
@@ -0,0 +1,25 @@
+var redisTag = require("../redis-tag")
+var bookTagger = new redisTag.Taggable("book")
+var redis = require("redis")
+var client = redis.createClient()
+
+bookTagger.set(1, ["javascript", "server", "programming"], function(rsp){
+ bookTagger.set(2, ["server", "programming"], function(rsp){
+ bookTagger.set(3, ["javascript", "programming"], function(rsp){
+
+ console.time('10,000 - finds')
+ for (var i = 0; i < 10000; i++)(function(i){
+ bookTagger.find(["programming", "server"], function(tags){
+ if(i == 9999){
+ console.timeEnd('10,000 - finds');
+ client.flushall()
+ client.quit()
+ bookTagger.quit()
+ }
+ })
+ })(i)
+
+ })
+ })
+})
+
View
22 benchmark/read.js
@@ -0,0 +1,22 @@
+var redisTag = require("../redis-tag")
+var bookTagger = new redisTag.Taggable("book")
+var redis = require("redis")
+var client = redis.createClient()
+
+
+bookTagger.set(1, ["javascript", "server", "programming"], function(rsp){
+
+ console.time('10,000 - gets')
+ for (var i = 0; i < 10000; i++)(function(i){
+ bookTagger.get(1, function(tags){
+ if(i == 9999){
+ console.timeEnd('10,000 - gets');
+ client.flushall()
+ client.quit()
+ bookTagger.quit()
+ }
+ })
+ })(i)
+
+})
+
View
19 benchmark/write.js
@@ -0,0 +1,19 @@
+var redisTag = require("../redis-tag")
+var bookTagger = new redisTag.Taggable("book")
+var redis = require("redis")
+var client = redis.createClient()
+
+console.time('10,000-taggings');
+
+for (var i = 0; i < 10000; i++)(function(i){
+ bookTagger.set(i, ["javascript", "server", "programming"], function(rsp){
+ if(i == 9999){
+ console.timeEnd('10,000-taggings');
+ client.flushall()
+ client.quit()
+ bookTagger.quit()
+ }
+ })
+})(i)
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.