[Webkit-unassigned] [Bug 218996] New: Implement PerformanceResourceTiming.transferSize
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Nov 16 12:05:55 PST 2020
https://bugs.webkit.org/show_bug.cgi?id=218996
Bug ID: 218996
Summary: Implement PerformanceResourceTiming.transferSize
Product: WebKit
Version: Safari 14
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: Platform
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jakub.g.opensource at gmail.com
Safari is the last browser lacking some PerformanceResourceTiming fields:
https://developer.mozilla.org/en-US/docs/web/api/performanceresourcetiming
(see also the following bugs: 168543 198293 185870)
'transferSize' (and 'encodedBodySize') is interesting because for example it allows distinguishing page loads with full cache vs empty cache for performance monitoring:
https://nicj.net/resourcetiming-in-practice/#cached-resources
Based on Nic's blog, I've been using the following code in production to iterate over critical requests and check for cache status and calculate cache hit ratio (and then be able to split performance monitoring graphs based on that):
```
if (window.PerformanceResourceTiming && 'transferSize' in PerformanceResourceTiming.prototype) {
function getCacheStatus(item) {
if (item.transferSize === 0) {
return 'hit'
} else if (
item.transferSize > 0 &&
item.encodedBodySize > 0 &&
item.transferSize < item.encodedBodySize
) {
return 'revalidation'
}
return 'miss'
}
performance.getEntriesByType('resource').filter(...).map(getCacheStatus).reduce(...)
}
```
But since Safari does not support it, it's not possible to have this kind of visibility about cache hit ratios for Safari users, nor compare cold cache vs warm cache RUM data.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201116/a67e845c/attachment.htm>
More information about the webkit-unassigned
mailing list