Git Product home page Git Product logo

service-worker-benchmark's Introduction

Service Worker Benchmarks

Current versions of Chrome/Blink support Service Workers, a web platform standard that enables application authors to provide rich offline and mobile experiences. These benchmarks measure the latency penalty required in order to deliver these additional features, and help make the web faster.

How do I use this code?

To run a benchmark, clone the repository and serve it locally over HTTP:

% git clone [email protected]:chromium/service-worker-benchmarks.git
% cd service-worker-benchmarks/
% ./generate_scopes.sh
% ./generate_static_pages.sh
% python -mSimpleHTTPServer :1337

and then open http://localhost:1337 in a browser. By default, the benchmark tests the time to load 200 images under five different scenarios. These correspond to cases where a Service Worker:

  1. is empty;
  2. does not call respondWith;
  3. calls respondWith(fetch(...));
  4. uses caches.match(...) (both hits and misses); or
  5. constructs a local synthetic response;

as well as a control case with no Service Worker. These values are printed in TSV format to the web console.

What can be measured with this tool?

Natively, this software supports varying:

  1. the number of requests;
  2. the concurrency of requests to the worker;
  3. the fetch path (which element or function is triggering the request); and
  4. the size of the response;

as well as the Service Worker being tested. The code also generates a request latency distribution, allowing more granular testing of tail latency.

What Service Worker behaviors are tested?

There are five different classes of behavior that are tested:

  1. Empty/Fallthrough workers, where the worker provides no response.
  2. New Response workers, where the response immediately resolves.
  3. Respond With Fetch, where the worker requests the result from the network.
  4. CacheStorage Hit, where the worker reads from the CacheStorage.
  5. CacheStorage Miss, where the worker attempts to read from the cache before hitting network.

as well as an experimental Respond With (Fast) Fetch that dynamically rewrites a Respond With Fetch worker into a renderer fallback.

Does this test only work in Chrome?

The code was written to use Google Chrome M45+, but tracks the behavior of the spec (it uses no internal or vendor-specific APIs). As a result, it should be possible to generate data for other browsers once the respective features ship.

service-worker-benchmark's People

Contributors

fatlotus avatar

Watchers

rosa maria palacios juncosa 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.