Service Worker slow response times for css

2019-05-27 14:22发布

问题:

We have service worker written on top of sw-toolbox. Once the static resources are cached service worker is taking longer time especially for downloading css resources (30 - 100ms) where as for js resources the time is almost 0.

CSS load times :

Load 1 : 35ms

Load 2 : 25ms

Load 3 : 101ms

Load 4 : 22ms

Js load times :

Load 1 : 0 ms

Load 2 : 0 ms

Load 3 : 0 ms

Load 4 : 0 ms

Question :

1.Why css load times are higher with service worker? Would be really helpful to us if someone can provide insight on this.

2.We use preload (async) for loading css , with higher load times for css service worker is fetching css bit late ( after fetching js) due to which page content is getting displayed with out css at first and later with css ( i.e Flickering effect , content without css to content with css)