-
Notifications
You must be signed in to change notification settings - Fork 7
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
node run and build take a lot of memory #155
Comments
|
After disabling monaco editor:
Massive difference |
Disabling xtermjs, cesium and layers reduces significantly further.
|
Disabling store/mdoules/schema.js and plugins/mavlink/mavlinkEnumData.json reduces the main app.js a massive amount:
|
Removed vuelayers (still being called by Planner2d component)
|
@SamuelDudley - i'm going to permanently remove monaco from the main vue.config.js because it increases the size of the build by about 10x! |
So considering -web will be served mainly over a local network, others are not likely going to use -web rather -web-dist and we have a way of reliability building -web-dist from -web do you think the bundle size actually matters? |
I should add I'm okay with removing stuff, but I want to maintain a branch with it included so that the hours of work to date are not lost to bitrot. |
Example chunking and removal of unused features |
Links to some tools to help with bundle analysis and code splitting https://github.com/kristerkari/awesome-bundle-size https://github.com/webpack-contrib/webpack-bundle-analyzer |
Rollup and parcel both support Vue and tree shaking. |
When you're talking about a factor of 5-10 then I think it really matters - it's not just that you're loading 8-10mb javascript over the network, it's that your poor browser has to execute that 8-10mb javascript. It's why the ttfp was so slow. This is just as much about the size and speed of -web-dist than memory usage of -web. I'm absolutely not talking about losing any of the work that either of us have done, just disabling it all except for the basics so we can see what is actually necessary. What's in master now is really the basic core of what we can get away with - vue, vuex, vue-router, vuetify, apollo, and we're down to about 1mb js. This can be further improved with treeshaking and chunking - certainly vue and vuetify can be improved significantly. I've disabled the mavlink-related components (cockpit, planner in particular) which then removes the likes of vuelayers/openlayers, pixi.js, cesium, and disabled the more advanced config features like xtermjs and monaco. All of this is simply disabled btw, none of the code is gone. Then, we can start to re-enable carefully, watching the bundle size and ttfp as we go along. I suggest that for the 1.2 release we keep all the mavlink stuff disabled and just concentrate on the config, maverick and video modules. |
@cglusky I haven't used either before, certainly worth a look long term. @fnoop Taking a step back, my thoughts are that -web is very different to a normal webpage, e.g. a web store that is used to sell mountain bikes. Using the bike store example, loading and execution times are very important as delays in getting pictures rendered might be the difference in a sale vs a user giving up and looking somewhere else. In the case of maverick-web users are much more heavily invested in the whole maverick / autonomous system ecosystem and will happily deal with much longer start-up times. I agree with what you are doing and your plan. I just wanted to ensure that we don't limit ourselves for the sake of a small bundle size and super fast ttfp. On the ttfp: In vue-vanilla-cesium I enabled chunking of cesium (https://github.com/SamuelDudley/vue-vanilla-cesium/blob/master/vue.config.js#L81) and lazy loading of the web endpoint that used cesium in the vue router (https://github.com/SamuelDudley/vue-vanilla-cesium/blob/master/src/router/index.ts#L12) The combination of those two optimizations means that the application loads the login screen instantly and then starts parallel background requests to pull down the cesium js bundle as the user types into the login form. |
Yes I completely agree. I just think it had got a bit out of hand and wanted to get back to basics and get that right before going forward! |
see https://github.com/goodrobots/maverick-web/tree/ttfp for changes to reduce ttfp edit: we will need to update the icon names as this requires moving to material design icons: |
most of the delay in ttfp when viewing the webpage via |
have a look at https://goodrobots.github.io/maverick-web/ to get a feel for the current page load speed. |
Some testing with a new vue-cli repo leads me to believe that vuetify is already being tree shaken. |
Before enabling xterm, a Built web page definitely much faster to load. It has now chunked into dozens of files which means lots of http connections. Also lots of warnings in the build process so needs tidying up a bit. |
After xterm, yarn build still takes about 700mb, size of build: app (1.61 MiB). Odd. |
I think my chunking strategy is a bit aggressive currently. We can tweak it to make less, larger chunks. |
There is a brilliant report built and pushed to -web-dist: The chunking is working great - it's much better than without. If we can reduce the core chunking in the future that would be great. |
Sorry, I thought you were aware of that report feature! As you can see its chunking each npm package individually. We can keep this logic in place and add a few hand crafted rules to merge a lot of the smaller bits of common code. |
yarn build
on a 2gb VM quickly exhausts the memory and crashes the VM.yarn run
uses 1Gb+ rss in usage.yarn build
produces a 38Mb output.Need to reduce all.
The text was updated successfully, but these errors were encountered: