Coder Social home page Coder Social logo

l3tum / serviceworker Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.19 MB

JavaScript Service Worker Implementation and Research

License: MIT License

HTML 0.27% JavaScript 99.73%
benchmark lookup service-worker cachestorage javascript-service-worker serviceworker service worker lookup-array

serviceworker's Introduction

ServiceWorker

JavaScript Service Worker Implementation and Research

The Implementation will be completely plugin-and-ready once it's done.


Research

So I was testing some stuff out regarding caching and wondered if it'd be faster to split the cache, and if yes, to do a manual lookup before matching in cache.

1. Question:

Would it be faster to store the names of all caches in an array and whenever you try to get something from the cache, first look through this array to see which cache to look in?

So I wrote a little benchmark and surprise, cachestorage is way faster than the array lookup beforehand. Maybe it would be faster to store the exact URLs in the lookup array, but then you would just recreate the cachestorage....

Anyways, here's the benchmark for anyone wanting to look into it: Benchmark

2. Question

Is using multiple, dedicated caches at all beneficial aside from for development when you have to clear the JS-Cache multiple times?

I wrote, again, a little benchmark. Since what we wanted to test there is the actual speed I included the setup of the caches in the actual test. Unfortunately given the nature of these tests I had to add some await keywords.

Overall, what might be already obvious, but I was curious if CacheStorage caches had any type of advanced lookup mechanism, is that using just one giant cache is the best solution, both in read and write it seems.

Here is the benchmark.


© Tom "L3tum" Pauly

serviceworker's People

Contributors

l3tum avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.