Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(duplicated-javascript): exclude header size for estimating wasted bytes #15667

Merged
merged 3 commits into from
Dec 7, 2023

Conversation

connorjclark
Copy link
Collaborator

following up to #15640, but doing it for duplicated-javascript.

The estimated savings changed so drastically b/c the test took a shortcut involving mixing artifacts from two different sources. The old transfer estimate ratio would use script.length as the content length to divide the transfer size w/ to get the ratio - but that script content was from coursehero logs, and the transfer size was from paulirish.com. The new content size estimate function will first look at network.resourceSize, and only fallback to script.length if the network record is missing. Hence the big shift in the test results.

@connorjclark connorjclark requested a review from a team as a code owner December 6, 2023 22:57
@connorjclark connorjclark requested review from adamraine and removed request for a team December 6, 2023 22:57
Base automatically changed from move-transfers to main December 6, 2023 23:43
@connorjclark connorjclark changed the title core(duplicated-javascript): exclude header size for estimating wasted bytes core(duplicated-javascript): exclude header size for estimating wasted bytes Dec 6, 2023
// FYI: older devtools logs (like our test fixtures) seems to be lower case, while modern logs
// are Cased-Like-This.
const pattern = /^content-encoding$/i;
return record.responseHeaders.some(item => item.name.match(pattern));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: item.name.toLowerCase() has worked in the past. Just easier to read than a regex IMO but up to you

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lots of headers / churn with temporary strings, so I wanted to avoid

@connorjclark connorjclark merged commit 8ab59ee into main Dec 7, 2023
29 checks passed
@connorjclark connorjclark deleted the dup-js-transfers branch December 7, 2023 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants