Created
August 8, 2012 07:27
-
-
Save pixelcort/3293115 to your computer and use it in GitHub Desktop.
PouchDB scalability tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pouch('idb://alpha', function(err, alpha) { | |
if (err) throw err; | |
console.log('a of b'); | |
Pouch('idb://beta', function(err, beta) { | |
if (err) throw err; | |
window.alpha = alpha; | |
window.beta = beta; | |
console.log('dbs ready'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.i=0; | |
f=function(){ | |
if (i===10000) return console.log('done'); | |
i++; | |
console.log('wip'); | |
alpha.put({},f); | |
}; | |
f(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.a=new Date(); | |
Pouch.replicate('idb://alpha','idb://beta', {}, function(err, changes) { | |
window.b=new Date(); | |
console.log('done: ' + (b-a)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.i=0, window.d={_id:'b', iter:0}; | |
window.f=function(){ | |
if (i===10000) return console.log('done'); | |
i++; | |
console.log('wip'); | |
d.blah=Math.random(); | |
d.iter++; | |
alpha.put(d, function(e,r) { | |
d._rev = r.rev; | |
setTimeout(f,1); | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment