Created
January 22, 2016 12:05
-
-
Save leplatrem/3145f6b59a483aaf8a39 to your computer and use it in GitHub Desktop.
benchmark kinto
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="kinto-dev.js"></script> | |
</head> | |
<body> | |
<h1>Benchmark</h1> | |
<p><span id="count">?</span> records in <span id="time">?</span> sec. | |
<button id="run">Run</button> | |
<button id="clear">Clear</button> | |
<script type="text/javascript"> | |
var db = new Kinto({remote: "http://kinto-leplatrem.herokuapp.com/v1", bucket: "guessign", dbPrefix: "guessign"}); | |
var collection = db.collection("fr"); | |
var btn = document.getElementById("run"); | |
btn.onclick = function () { | |
var before = new Date().getTime(); | |
collection.sync() | |
.then(function (result) { | |
var after = new Date().getTime(); | |
var elapsed = after - before; | |
document.getElementById("count").innerHTML = result.created.length + result.updated.length; | |
document.getElementById("time").innerHTML = elapsed / 1000; | |
}); | |
} | |
var btn = document.getElementById("clear"); | |
btn.onclick = function () { | |
collection.clear(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment