Skip to content

Instantly share code, notes, and snippets.

@pixelcort
Created August 8, 2012 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelcort/3293115 to your computer and use it in GitHub Desktop.
Save pixelcort/3293115 to your computer and use it in GitHub Desktop.
PouchDB scalability tests
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');
});
});
window.i=0;
f=function(){
if (i===10000) return console.log('done');
i++;
console.log('wip');
alpha.put({},f);
};
f();
window.a=new Date();
Pouch.replicate('idb://alpha','idb://beta', {}, function(err, changes) {
window.b=new Date();
console.log('done: ' + (b-a));
});
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