Re: [w3c/ServiceWorker] Pagination in cache.keys() (#1066)

I agree that at some point the API will fail to scale, but I think some the issues here are down to implementation.  For example, I wrote a test that isolates the read time from the write time and see this in firefox:

1) browser does not crash
2) cache.keys() takes ~900ms to complete

Your current test case did not wait for the cache.put() writes to complete before starting the cache.keys().

This is the code I ran:

```
function fill(cache) {
  let list = [];
  for (let i = 0; i < 30000; ++i) {
    list.push(cache.put('https://example.com/probably-crash-' + i, new Response('ok')))
  }
  return Promise.all(list);
}

function read(cache) {
  let start = performance.now();
  cache.keys().then(keys => {
    let end = performance.now();
    console.log(end - start);
  })
}

caches.open('foo').then(cache => { fill(cache).then(_ => read(cache) ) })
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1066#issuecomment-277277361

Received on Friday, 3 February 2017 15:31:24 UTC