Open Bug 1907250 Opened 2 years ago Updated 7 days ago

Investigate coalescing ongoing loads for script cache

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

People

(Reporter: arai, Unassigned)

References

(Blocks 1 open bug)

Details

The initial prototype for navigation cache (bug 1896709) coalesces loads only when the stencil for the response is already cached.
We may be able to extend it to coalesce ongoing loads, but with some restrictions.

(A) always coalesce to ongoing loads, but restart the subsequent loads when the response turns out to be not cacheable

cacheable case:

  1. request A is started
  2. request A starts network load LA
  3. request A is added to the cache
  4. request B is coalesced to request A
  5. load LA got response, where it's cacheable
  6. load LA's response body is compiled to stencil SA
  7. request A uses stencil SA
  8. request B uses stencil SA

not cacheable case:

  1. request A is started
  2. request A starts network load LA
  3. request B is started
  4. request B is coalesced to request A
  5. load LA got response, where it's not cacheable
  6. load LA's response body is compiled to stencil SA
  7. request A uses stencil SA
  8. request B starts network load LB
  9. load LB got response and it's compiled to stencil SB
  10. request B uses stencil SB

(B) coalesce to ongoing loads only when the response is confirmed to be cacheable

cacheable case:

  1. request A is started
  2. request A starts network load LA
  3. load LA receives non-redirect response header, where it's cacheable
  4. request B is started
  5. request B is coalesced to request A, because it's confirmed to be cacheable
  6. load LA receives the entire response body, and it's compiled to stencil SA
  7. request A uses stencil SA
  8. request B uses stencil SA

not cacheable case:

  1. request A is started
  2. request A starts network load LA
  3. request B is started
  4. request B is not coalesced to request A, because it's not yet confirmed to be cacheable
  5. load LA receives non-redirect response header, where it's not cacheable
  6. request C is started
  7. request C is not coalesced to request A, because it's confirmed to be not cacheable

Maybe another alternative would be to keep the loads, but coalesce the result while discarding any other loads?
(rereading) I guess this is what (B) is about, keeping the loads and coalescing after.

You need to log in before you can comment on or make changes to this bug.