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): display as transfer size #10701

Merged
merged 8 commits into from
Jun 17, 2020

Conversation

connorjclark
Copy link
Collaborator

in #10700 Patrick suggested I refactor the sizes here too. I realized that the table was mistakenly showing resource sizes.

The opportunity savings estimate is from the wastedBytesByUrl map, which was correctly using transfer size, so estimated savings won't change.

@connorjclark connorjclark requested a review from a team as a code owner May 4, 2020 21:25
@connorjclark connorjclark requested review from paulirish and removed request for a team May 4, 2020 21:25
@connorjclark
Copy link
Collaborator Author

connorjclark commented May 4, 2020

side note: @patrickhulce think this should be named duplicate-javascript instead of duplicated-javascript? I can't tell what matches up best with unminified-javascript and unused-javascript ...

@patrickhulce
Copy link
Collaborator

🤷 eh duplicated-javascript seems fine to me.

I agree duplicate-javascript is more correct for the overall concept we're referring to as it's duplicate javascript in general we're flagging and not trying to say one specific version is the bad "duplicated" version. However, they all complete the phrase "You have ____ on your page" and all our other <adjective>-javascript ones use the participle adjective so I say keep it as-is

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

most of this depends on the resolution to my first question about sourceSize actually being transfer size :)

@@ -85,156 +85,86 @@ describe('DuplicatedJavascript computed artifact', () => {
Object {
"source": "Control/assets/js/vendor/ng/select/select.js",
"sourceBytes": Array [
48513,
48513,
16009,
Copy link
Collaborator

Choose a reason for hiding this comment

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

hm this feels weird to say that the sourceBytes are transferSize, no?

I agree with wasted computations using transferSize, that seems great 👍 (based on what was happening with wastedBytesByUrl I assumed they already were, and looks like that was half true and we were only using that for the opportunity savings and not the displayed wasted bytes?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hm this feels weird to say that the sourceBytes are transferSize, no?

sourceTransferBytes? I'm wondering if in the long run we'd want to modify the bytes type: {transfer: ..., resource: ...}.

based on what was happening with wastedBytesByUrl I assumed they already were, and looks like that was half true and we were only using that for the opportunity savings and not the displayed wasted bytes

yea, that map is only for the base class to calculate savings in latern. only showed up as the seconds savings estimate in the report.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sourceTransferBytes sgtm 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually, given that wastedBytes and totalBytes on all opportunities are in terms of transfer size, I'm hesitant to break consistency in naming here. We don't specify transfer or resource bytes in any of our byte keys.

why does it feel weird?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it feels weird here because we're specifically talking about the source code, unlike in all the other opportunities that are always talking about what was transferred. the introduction of source map data changes the game IMO because there's a completely new size we could be talking about, the original source code size. Calling something sourceSize makes me think it's the size of that original source code rather than the bytes that were transferred corresponding to a subset of that source code.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

sorry for the delay here @connorjclark I think this wound up mislabeled. were you waiting on me for anything else?

@@ -85,156 +85,86 @@ describe('DuplicatedJavascript computed artifact', () => {
Object {
"source": "Control/assets/js/vendor/ng/select/select.js",
"sourceBytes": Array [
48513,
48513,
16009,
Copy link
Collaborator

Choose a reason for hiding this comment

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

sourceTransferBytes sgtm 👍

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM other than the test changes that feel like something is off.

I'm guessing some of our "should never happen cases" are actually happening, because now we drop the subitem instead of just not getting the savings in lantern estimate

"wastedBytes": 4410,
},
Object {
"source": "js/src/utils/service/amplitude-service.ts",
Copy link
Collaborator

Choose a reason for hiding this comment

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

feels weird that so many of these disappeared, are they really being compressed that well they fall below 200 bytes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The estimated transfer size for this source is 1022, which is still above the 200 sub-item threshold.

It's elided because the per-item threshold is 1024 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lowered the threshold for this test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

oooooh the changed threshold wasn't for this test, gotcha gotcha, sorry for the noise :)

},
"totalBytes": 0,
"url": "",
"wastedBytes": 3098,
Copy link
Collaborator

Choose a reason for hiding this comment

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

like this one supposedly went from 3000+ bytes wasted to <200 bytes wasted?

@patrickhulce patrickhulce merged commit 749b250 into master Jun 17, 2020
@patrickhulce patrickhulce deleted the duplicated-js-sizes branch June 17, 2020 02:21
gMakunde pushed a commit to gMakunde/lighthouse that referenced this pull request Jul 6, 2020
gMakunde pushed a commit to gMakunde/lighthouse that referenced this pull request Aug 28, 2020
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.

5 participants