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

statically compress webpack artifacts #6266

Merged
merged 1 commit into from
Oct 16, 2019
Merged

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Sep 26, 2019

What it does

Production mode
  • before 9.3Mb is transferred:

before-prod

  • after 2.5Mb is transferred:

after-prod

Development mode
  • before 22.5Mb is transferred:

before-dev

  • after 4.8Mb is transferred:

after-dev

How to test

  • Build in production and development before and after changes.
  • Load the application without the cache and check how much traffic is transferred in each time.
  • In development mode pay attention whether bundles are reused on incremental change in extensions.

Review checklist

Reminder for reviewers

yarn.lock Show resolved Hide resolved
@benoitf
Copy link
Contributor

benoitf commented Sep 27, 2019

I would not use it for dev mode.

@akosyakov
Copy link
Member Author

I would not use it for dev mode.

Yeah, in such state I agree, but generally i would like to have it for the dev mode. I had bad experience of developing Theia from airports WiFis, Russian on mobile connections and obviously with EclipseCon WiFi in Ludwisburg. Looking into fixing compression with watch mode in the webpack plugin.

@akosyakov
Copy link
Member Author

akosyakov commented Oct 14, 2019

I've opened a PR against the compression plugin to improve the development mode: webpack-contrib/compression-webpack-plugin#134

For time being, I've published our fork with a fix and used it in this PR.

Results are pretty good, now in the development mode a change in the plugin system requires redownloading 134 kb vs 800kb before.

Screen Shot 2019-10-14 at 16 47 08

And initially one has to download 4.6 Mb for development instead of 22.5 before.

Screen Shot 2019-10-14 at 16 46 33

@akosyakov akosyakov marked this pull request as ready for review October 14, 2019 14:53
@akosyakov
Copy link
Member Author

@AlexTugarev could you review, confirm results please? It would be good to have it done before EclipseCon.

@akosyakov
Copy link
Member Author

I will add an option to pass to theia webpack to disable it.

@akosyakov
Copy link
Member Author

Clarifications how to test:

  • disable cache in network tab
  • clean network tab and logs
  • reload the page
  • check transfered data in the network tab
  • test this PR and build from master to see the difference

@AlexTugarev
Copy link
Contributor

AlexTugarev commented Oct 15, 2019

how I verified this:

regular build in dev mode

this PR

Screen Shot 2019-10-15 at 09 58 31

vs current master

Screen Shot 2019-10-15 at 09 59 52


watched browser example in dev mode

(after changing core package)

this PR

(reloaded twice! divide in half for comparison)
(here I also played with link conditioner app on osx; switched to 3G mode)

Screen Shot 2019-10-15 at 09 37 10

vs current master

Screen Shot 2019-10-15 at 10 14 04

@benoitf
Copy link
Contributor

benoitf commented Oct 15, 2019

we won't merge it until it PR is merged upstream, correct ?

@akosyakov
Copy link
Member Author

@AlexTugarev yes, it shows you that for this PR 4.6 Mb is transferred vs 23.9 Mb on master. You should also check in dev mode, i.e.

  • disable disable cache
  • watch example app
  • watch some extension
  • change some extension
  • check how much is loaded against master

@akosyakov
Copy link
Member Author

akosyakov commented Oct 15, 2019

we won't merge it until it PR is merged upstream, correct ?

Why? We tested that it works for us in different conditions. PR in upstream has tests as well. webpack guys can review it for several months, EclipesCon is next week. There would be also an option to disable it if something goes wrong for downstream projects.

@benoitf
Copy link
Contributor

benoitf commented Oct 15, 2019

But if we do forks on each issue we had on upstream projects it's like nightmare to maintain.
I don't see why we should use code from un-merged PR upstream.

EclipesCon is next wekk.

About EclipseCon, I don't see how it's related. If you work locally you don't transfer new stuff each time. If it's about hosted version, it's not related to Eclipse Theia but more a theia/gitpod assembly issue.

@AlexTugarev
Copy link
Contributor

If it's about hosted version, it's not related to Eclipse Theia but more a theia/gitpod assembly issue.

@benoitf we want to make a Theia workshop, and this PR will improve the development experience a lot.

@akosyakov
Copy link
Member Author

akosyakov commented Oct 15, 2019

About EclipseCon, I don't see how it's related. If you work locally you don't transfer new stuff each time. If it's about hosted version, it's not related to Eclipse Theia but more a theia/gitpod assembly issue.

Yes, we are going to use Gitpod, but it is not related to how we deploy Gitpod. It is about improving development of Theia remotely. Gitpod, or any other services, should not do any caching/compression of user traffic (resources served by user apps). I've added to dev meeting. It is important for good experience next week. cc @marcdumais-work @svenefftinge

@akosyakov
Copy link
Member Author

akosyakov commented Oct 15, 2019

But if we do forks on each issue we had on upstream projects it's like nightmare to maintain.
I don't see why we should use code from un-merged PR upstream.

It is not ideal, but sometimes you should move forward somehow. We do it for @theia/node-pty and @typefox/monaco-editor-core as well.

@benoitf
Copy link
Contributor

benoitf commented Oct 15, 2019

well, IMHO we shouldn't

For example node-pty upstream is 0.8.1, forked is still on 0.7.8
and monaco editor core is 0.18.1 while fork is 0.18.0-next.1 (so you don't know well the diff as well)

published package are also referencing to the upstream github URLs and not the forked one.

also I don't see why sometimes we use @theia namespace and sometimes @typefox

@akosyakov
Copy link
Member Author

akosyakov commented Oct 15, 2019

For Monaco there is no another way. We want to consume internal APIs of VS Code editor to implement VS Code support. Default Monaco distribution tree shakes a lot making it impossible. You can learn a bit more here: https://github.com/eclipse-theia/theia/wiki/LSP-and-Monaco-integration

For other, I'm agree that we should move to latest version at some point. But It's decided by a need of the project, not by desire to use latest versions. Otherwise we will spend all our time updating dependencies each day. If there are no important bug fixes and improvements in these dependencies, we can live with our forks forever there is no a tragedy here.

@akosyakov
Copy link
Member Author

akosyakov commented Oct 15, 2019

also I don't see why sometimes we use @theia namespace and sometimes @typefox

That's more the historical reason for Monaco. I will republish compression plugin under @theia.

@akosyakov
Copy link
Member Author

akosyakov commented Oct 15, 2019

published package are also referencing to the upstream github URLs and not the forked one.

I think it is good. Bugs should be opened against the parent repo. That's for example what devs do who forked monaco-languageclient last year. They send users to the main repo. It's also not really important since only we use it.

@akosyakov akosyakov force-pushed the ak/webpack_compress branch 2 times, most recently from deafdb8 to fc34766 Compare October 15, 2019 10:35
Signed-off-by: Anton Kosiakov <anton.kosyakov@typefox.io>
@akosyakov
Copy link
Member Author

@AlexTugarev have you managed to reproduce perf improvements in dev mode?

@akosyakov
Copy link
Member Author

We've agreed during the dev meeting with @marcdumais-work :

  • that this PR improves production experience generally, especially for our docker images;
  • it improves development mode on slow network;
  • that using our fork is fine whenever we find is practical, although:
    • our solution should be properly communicated to the upstream project as an issue or a PR;
    • fork should be under theia-ide org, under @theia npm scope name;
    • there should be an issue to switch to upstream when an issue gets resolve there.

We can transfer monaco-editor-core under theia-ide org during next migration: #6223 (comment) Getting rid of Monaco fork is impossible, since it makes the plugin system impossible to implement.

@AlexTugarev Could you finish the review please?

description: "Mode to use",
choices: ["development", "production"],
default: "production"
}).option('static-compression', {
Copy link
Contributor

Choose a reason for hiding this comment

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

q: no-static-compression vs static-compression?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@AlexTugarev AlexTugarev left a comment

Choose a reason for hiding this comment

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

This changes speed up iterating on changes in dev mode significantly. 👍

@akosyakov akosyakov merged commit 3ddb313 into master Oct 16, 2019
@akosyakov akosyakov deleted the ak/webpack_compress branch October 16, 2019 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance issues related to performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Webpack] Assets could be compressed to improve delivery times
4 participants