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

report: gzip treemap data #12519

Merged
merged 35 commits into from
May 27, 2021
Merged

report: gzip treemap data #12519

merged 35 commits into from
May 27, 2021

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented May 19, 2021

@google-cla google-cla bot added the cla: yes label May 19, 2021
@connorjclark connorjclark changed the title report: encode data even if very large report: gzip treemap data May 20, 2021
@@ -23,6 +23,8 @@ const REPORT_JAVASCRIPT = [
fs.readFileSync(__dirname + '/renderer/pwa-category-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/report-renderer.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/i18n.js', 'utf8'),
fs.readFileSync(__dirname + '/renderer/base64.js', 'utf8'),
fs.readFileSync(require.resolve('pako/dist/pako_deflate.min.js'), 'utf-8'),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is probably problematic for devtools...

Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like we could skip deflate in most of our environments and be ok falling back to non-gzipped if compressionstreams aren't supported? now that I say this I wonder how much value all of this gzip business has to begin with...

it's the inflate side where they're sharing it out that it's critical to support if we support deflate anywhere

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

seems like we could skip deflate in most of our environments and be ok falling back to non-gzipped if compressionstreams aren't supported?

done.

now that I say this I wonder how much value all of this gzip business has to begin with...

I got 10kb for the treemap options, vs ~60kb if no gzip. Either way, it's a really long URL. And both are too long for every URL shortener service I've tried.

I'm fine without the gzip. @paulirish ?


/* global self btoa atob window CompressionStream Response */

const btoaIso = typeof btoa !== 'undefined' ?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Iso?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

isomorphic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

prefer btoa_?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah gotcha, yeah btoa_ was what I had in my head, or btoaIsomorphic :D

Copy link
Member

Choose a reason for hiding this comment

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

i think there's fair consensus that 'atob' is one of the worst named APIs of the web… so i don't love calling our stuff that.

should either go full out asciiToBinary if you wanna honor that API or otherwise something like textToBase64String. I'm fine leaving off the isomophoric suffix, but could add a comment above to explain why we do it so funny

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think there's fair consensus that 'atob' is one of the worst named APIs of the web… so i don't love calling our stuff that.

I totally agree, and I fully support never naming our APIs atob or btoa.

However, internal to this I think there's value in reflecting what underlying methods are being used to perform this so I'd strongly prefer asciiToBinary to a complete rename. We already did the complete useful rename for the API surface of this module :)

Copy link
Member

Choose a reason for hiding this comment

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

sg

@@ -71,7 +81,7 @@ declare global {
export interface StackPackDescription {
/** The title of the stack pack. */
title: string;
/** A base64 data url to be used as the stack pack's icon. */
/** A TextEncoding data url to be used as the stack pack's icon. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

too far ;)

* @license Copyright 2021 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
Copy link
Member

@brendankenny brendankenny May 27, 2021

Choose a reason for hiding this comment

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

speaking of #12570 (comment), there used to be a thing with the closure license checker and the files in renderer/, which is why they all have the usual long(er) form of the Apache 2 header. Have you tried importing this yet? Or is that no longer flagged

edit: or I guess it was license-header line length? Weird. But still, same question :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Seems like something that would only show up in the CL check, which I never did (just built and manually tested). If that's the case, I'll edit in the import and just make a new PR here that can land whenever.

Copy link
Member

Choose a reason for hiding this comment

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

Seems like something that would only show up in the CL check, which I never did (just built and manually tested). If that's the case, I'll edit in the import and just make a new PR here that can land whenever.

Is there any downside to changing it now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

snippet renderer has the same comment and is in BUILD, so it should be fine

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

5 participants