This repository has been archived by the owner on Jul 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
[Enhancement] Lazy load components #274
Open
jayaike
wants to merge
11
commits into
Cloud-CV:master
Choose a base branch
from
jayaike:lazy-load-components
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jayaike
requested review from
live-wire,
sanketbansal,
Sanji515,
Ram81 and
RishabhJain2018
and removed request for
sanketbansal
January 15, 2020 10:35
Codecov Report
@@ Coverage Diff @@
## master #274 +/- ##
==========================================
- Coverage 50.66% 50.64% -0.02%
==========================================
Files 66 66
Lines 3766 3771 +5
Branches 442 444 +2
==========================================
+ Hits 1908 1910 +2
- Misses 1763 1766 +3
Partials 95 95
Continue to review full report at Codecov.
|
Merged
I guess this should be the key angular/angular-cli#14566 |
It's as a result of the lazy modules. The syntax is correct though. @Sanji515 |
Do you use yarn or npm. I use yarn |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #257
I have lazy-loaded all the routing modules. Below are the stats.
Development
Initial EvalAI-ngx Bundle size - 1.26MB (1290.24KB)
Current Bundle Size after optimization - 352KB (0.34MB)
Optimization ------- 72.7%
Production
Initial EvalAI-ngx Bundle size - 1.61MB (1648.64KB)
Current Bundle Size after optimization - 945KB (0.92MB)
Optimization ------- 42.8%
Methodology
Step 1: Feature Modules
I broke up all the components into feature modules in order to import them lazily. I divided them by purpose and route.
Step 2: Import Lazily (Change Routes)
I had to change all the routes to lazily import the feature modules. This way the user only loads the modules he/she uses at the time of need.
Step 3: Change Method of lazy-loading to
PreloadAllModules
Basically, what
PreloadAllModules
does is it waits for the initial component to load then it starts loading other links so as to reduce the loading time when navigating to other routes.As shown above, this new way of loading modules in EvalAI-ngx will increase the loading time of EvalAI-ngx and also improve User Experience by making the webpage smoother because it does not have all the modules loaded at once.
Although it took a whole night 🤣😂....It was worth it!
@Ram81 @RishabhJain2018 @pushkalkatara @Sanji515 @lunayach @vkartik97 Please let me know your thoughts.