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

test: track payload size for cli-hello-world-ivy #27797

Closed
wants to merge 2 commits into from

Conversation

cexbrayat
Copy link
Member

Adds size bundle tracking to the integration test cli-hello-world-ivy and updates the app itself to reflect the result of using the experimentalIvy flag on the CLI.
The result is similar to:

npx @angular/cli@next new cli-hello-world-ivy --experimental-ivy --defaults

But replaces the current (cli 7.2.0-rc.0) renderComponent bootstrap with the usual platformBrowserDynamic one.
It also keeps what the app did (display a pipe, tests it).

This has been added to track regressions in bundle sizes of a CLI app with Ivy enabled.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

Updates an integration test and adds tracking for the bundle size of the CLI app with Ivy enabled (which is currently weirdly high at 496K).

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This has been discussed on Slack with @petebacondarwin @IgorMinar and @alan-agius4

<base href="/">

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script>window['ngDevMode'] = true;</script>
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this is useful anymore, but maybe I'm mistaken.

Copy link
Member

Choose a reason for hiding this comment

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

I believe that this is now handled by CLI

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup. It shouldn't be needed. OK to drop.

@JoostK
Copy link
Member

JoostK commented Dec 21, 2018

Nice! The current payload size is so high because platformBrowserDynamic pulls in a lot of ViewEngine together with the Compiler infrastructure. If you switch to platformBrowser it will become significantly smaller (but still quite large). I wonder if the CLI replaces platformBrowserDynamic with platformBrowser during prod builds? Is the prod build actually tested here?

@cexbrayat
Copy link
Member Author

@JoostK thanks! Yes it should be the prod build. I don't know where the issue is, but we indeed end up with the compiler in the bundle (discussion in ivy-cli-build-size on Slack).

@JoostK
Copy link
Member

JoostK commented Dec 21, 2018

@cexbrayat It may be a good idea to verify that native ngtsc behaves the same. The cli-hello-world-ivy app uses ngcc to convert the packages_dist output, perhaps there's currently some discrepancies between its output when compared to native ngtsc builds.

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

Thx for the updates 🎉

Basically, this PR contains two changes (that should be in two separate commits imo):

  1. Update the cli-hello-world-ivy integration project to latest CLI.
  2. Enable payload-size checking for the same project.

The former looks great. I am not convinced about the latter at this point.
What is the reasoning for adding this check now, given that Ivy is still not finalized and bundle sizes are may change (hopefully downwards).

],
"angularCompilerOptions": {
"enableIvy": "ngtsc"
}
Copy link
Member

Choose a reason for hiding this comment

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

Does moving this here form tsconfig.json make a difference?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it really does, and this how experimentalIvy currently generates it

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason being that it’s here is that you can have multiple projects within a workspace which don’t necessarily use ivy.

That said for this case, there is no difference.

@gkalpak gkalpak added area: build & ci Related the build and CI infrastructure of the project action: review The PR is still awaiting reviews from at least one requested reviewer PR target: TBD labels Dec 21, 2018
@ngbot ngbot bot added this to the needsTriage milestone Dec 21, 2018
@cexbrayat
Copy link
Member Author

@gkalpak I can split in two commits if needed sure.

We added the size tracking because the result is currently weird (the bundle contains the compiler) after discussing it with Igor on Slack

@gkalpak
Copy link
Member

gkalpak commented Dec 21, 2018

Also note that BuildOptimizer currently does not work correctly with platformBrowserDynamic() (see angular/angular-cli#13261), so as long as the prod build is broken, it makes even less sense to check payload sizes imo.

@cexbrayat
Copy link
Member Author

Yeah we found out when digging out this issue :)

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@googlebot
Copy link

CLAs look good, thanks!

@cexbrayat
Copy link
Member Author

@gkalpak I splitted into two commits

Copy link
Member

@gkalpak gkalpak left a comment

Choose a reason for hiding this comment

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

The first commit seems more like build: ... (rather than test: ...). I would also be better to mention the cli version explicitly (e.g. build: update `cli-hello-world-ivy` to cli@...).

The second commit message mentions "track payload size", but the change does not really track it (in the sense that it saves it to Firebase and we can see how it evolves over time). It rather checks the payload size and fails the build if it deviates more than 1% percent from the set limits).
You might want to be more explicit on that in the commit message to avoid confusion in the future.

Also, if the intention was to actually record the size changes in Firebase, then you need more changes 😃

The code LGTM. I am still not convinced it adds much benefit to check the size when there are known bugs that affect bundling, but if @IgorMinar thinks so then it probably is so 😁

@cexbrayat
Copy link
Member Author

@gkalpak thanks for the feedback, I updated the commit messages 👍 I admit that I don't know the build setup well enough to add the necessary for recording the sizes in Firebase, but as you say that's probably not necessary right now.

@gkalpak
Copy link
Member

gkalpak commented Dec 23, 2018

(FWIW, I'd be happy to help setting that up, if/when we decide it makes sense to do so.)

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

This looks great! Thanks so much for getting it done!

@IgorMinar
Copy link
Contributor

@gkalpak the goal of this test is to prevent further regressions. We know that things are broken now, but as we fix them we need to prevent reintroducing more issues down the line.

@IgorMinar
Copy link
Contributor

IgorMinar commented Dec 25, 2018

As far as test/build/ci commit message types goes I'd categorize this as ci or test. See my definition of types at https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit

Having said that, the current pr is "good enough". But I won't stop you from making it perfect. 😉

@IgorMinar IgorMinar added the action: merge The PR is ready for merge by the caretaker label Dec 25, 2018
@IgorMinar IgorMinar added target: major This PR is targeted for the next major release and removed action: review The PR is still awaiting reviews from at least one requested reviewer PR target: TBD labels Dec 25, 2018
@cexbrayat
Copy link
Member Author

@IgorMinar Haha, changing a commit message is not the hardest part ;) I'll revert from build to test.

Updates the app itself to reflect the result of using the  `experimentalIvy` flag on the CLI.
The result is similar to:

    npx @angular/cli@next new cli-hello-world-ivy --experimental-ivy --defaults

But replaces the current (cli `7.2.0-rc.0`) `renderComponent` bootstrap with the usual `platformBrowserDynamic` one.
It also keeps what the app did (display a pipe, tests it).
Adds size bundle checking to the integration test `cli-hello-world-ivy`
@benlesh benlesh closed this in 62e45ce Dec 26, 2018
benlesh pushed a commit that referenced this pull request Dec 26, 2018
Adds size bundle checking to the integration test `cli-hello-world-ivy`

PR Close #27797
@gkalpak
Copy link
Member

gkalpak commented Dec 27, 2018

As far as test/build/ci commit message types goes I'd categorize this as ci or test. See my definition of types at https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit

The PR had 2 commits (one updating the project to the latest cli and one updating the tests to check for payload size changes).
The way I understand the type descriptions, I would still categorize the 1st commit as build (and the 2nd as test).
Is my understandign wrong? Is it because the cli-hello-world-ivy project is used for testing purposes, so everything related to that is a test change?

(@IgorMinar, asking to make sure we are on the same page and that I use appropriate types in my commit messages.)

devversion pushed a commit to devversion/angular that referenced this pull request Jan 9, 2019
Updates the app itself to reflect the result of using the  `experimentalIvy` flag on the CLI.
The result is similar to:

    npx @angular/cli@next new cli-hello-world-ivy --experimental-ivy --defaults

But replaces the current (cli `7.2.0-rc.0`) `renderComponent` bootstrap with the usual `platformBrowserDynamic` one.
It also keeps what the app did (display a pipe, tests it).

PR Close angular#27797
devversion pushed a commit to devversion/angular that referenced this pull request Jan 9, 2019
Adds size bundle checking to the integration test `cli-hello-world-ivy`

PR Close angular#27797
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
Updates the app itself to reflect the result of using the  `experimentalIvy` flag on the CLI.
The result is similar to:

    npx @angular/cli@next new cli-hello-world-ivy --experimental-ivy --defaults

But replaces the current (cli `7.2.0-rc.0`) `renderComponent` bootstrap with the usual `platformBrowserDynamic` one.
It also keeps what the app did (display a pipe, tests it).

PR Close angular#27797
ngfelixl pushed a commit to ngfelixl/angular that referenced this pull request Jan 28, 2019
Adds size bundle checking to the integration test `cli-hello-world-ivy`

PR Close angular#27797
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: build & ci Related the build and CI infrastructure of the project cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants