How to Make Resource Load From Memory Cache

136 views
Skip to first unread message

Hao Liu

unread,
Jul 26, 2022, 8:42:23 PM7/26/22
to Chromium-dev
Hi all,
I'm writing a wpt for test the scenario where a resource is loaded from memory cache.

I did a page that fetches a js file twice. but the second time is loaded from disk cache. 
Screen Shot 2022-07-26 at 8.36.44 PM.png

How can I make it (from memory cache)
like this?
Screen Shot 2022-07-26 at 8.41.12 PM.png

Thanks!

Dominic Farolino

unread,
Jul 26, 2022, 9:25:45 PM7/26/22
to Chromium-dev, Hao Liu, Noam Rosenthal
I'm not sure if the memory cache is well-defined enough to rely on a resource coming from the memory cache vs the disk cache at this point, so I'm not sure how interoperable the test would be. I think nrosenthal@ would have a good idea these days so let me loop him in here.

Kenichi Ishibashi

unread,
Jul 27, 2022, 12:43:50 AM7/27/22
to d...@chromium.org, Chromium-dev, Hao Liu, Noam Rosenthal
Some non-wpt web_tests use Internals.isLoadingFromMemoryCache() to check whether a resource is loaded from the memory cache. I don't know what's the criteria to serve a request from memory cache, but you may want to write a non-wpt web_tests in a way similar to these tests (e.g. image-value-cached.html).


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/f94c19e0-4406-444f-9ccd-a02f1a4f27aen%40chromium.org.

Noam Rosenthal

unread,
Jul 29, 2022, 8:22:55 PM7/29/22
to Chromium-dev, Kenichi Ishibashi, Chromium-dev, Hao Liu, Dominic Farolino
(Reposting, for some reason I'm not seeing it in the thread, hope it's not spamming)

I've been trying to write tests that cover this a while back:

And also trying to move the spec discussion forward:

My conclusion so far is that the memory cache is very non-interoperable and also relies on implementation-specific memory availability, which makes it very difficult to predict.
I hope that we can, at some point, spec how it works with resource-timing and with CSP, as those are observable aspects of that feature.

On Wednesday, July 27, 2022 at 7:43:50 AM UTC+3 Kenichi Ishibashi wrote:
Some non-wpt web_tests use Internals.isLoadingFromMemoryCache() to check whether a resource is loaded from the memory cache. I don't know what's the criteria to serve a request from memory cache, but you may want to write a non-wpt web_tests in a way similar to these tests (e.g. image-value-cached.html).


On Wed, Jul 27, 2022 at 10:26 AM Dominic Farolino <d...@chromium.org> wrote:
I'm not sure if the memory cache is well-defined enough to rely on a resource coming from the memory cache vs the disk cache at this point, so I'm not sure how interoperable the test would be. I think nrosenthal@ would have a good idea these days so let me loop him in here.

On Tuesday, July 26, 2022 at 8:42:23 PM UTC-4 Hao Liu wrote:
Hi all,
I'm writing a wpt for test the scenario where a resource is loaded from memory cache.

I did a page that fetches a js file twice. but the second time is loaded from disk cache. 
Screen Shot 2022-07-26 at 8.36.44 PM.png

How can I make it (from memory cache)
like this?
Screen Shot 2022-07-26 at 8.41.12 PM.png

Thanks!

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Noam Rosenthal

unread,
Jul 29, 2022, 8:23:51 PM7/29/22
to Chromium-dev, Dominic Farolino, Hao Liu, Noam Rosenthal
I've been trying to write tests that cover this a while back:

And also trying to move the spec discussion forward:

My conclusion so far is that the memory cache is very non-interoperable and also relies on implementation-specific memory availability, which makes it very difficult to predict.
I hope that we can, at some point, spec how it works with resource-timing and with CSP, as those are observable aspects of that feature.

Reply all
Reply to author
Forward
0 new messages