Last active
October 17, 2018 13:29
-
-
Save leplatrem/1c9a45ef92f2f56b369e87bf1db4548d to your computer and use it in GitHub Desktop.
IDB list perfs
This file contains hidden or 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="//unpkg.com/[email protected]/dist/kinto.noshim.js" | |
integrity="sha384-HAvdRnGimsCGQDQo6XnILXgZ3rJGI2RGQXdrH0wLZURMuFNyZIvYOOrAwgs2nsgj" | |
crossorigin="anonymous"> | |
</script> | |
</head> | |
<body> | |
<h1>Benchmark</h1> | |
(see console) | |
<button id="run">Run</button> | |
<script type="text/javascript"> | |
const db = new Kinto({remote: "https://firefox.settings.services.mozilla.com/v1", bucket: "main"}); | |
const collection = db.collection("tippytop"); | |
const btn = document.getElementById("run"); | |
btn.onclick = async function () { | |
btn.disabled = true; | |
console.time("sync"); | |
await collection.sync(); | |
console.timeEnd("sync"); | |
console.time("list all"); | |
await collection.list(); | |
console.timeEnd("list all"); | |
console.time("filter by id"); | |
await collection.list({filters: {id: "7210b4bc-81f6-4f04-976e-1acf5faeb740"}}); | |
console.timeEnd("filter by id"); | |
console.time("filter by attribute"); | |
await collection.list({filters: {domain: "amazon.es"}}); | |
console.timeEnd("filter by attribute"); | |
btn.disabled = false; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment