Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Add caching to improve the loading speed #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lunayach
Copy link
Member

Enabled Caching to improve the loading speed.

Changes proposed in this pull request:

  • Enabled service workers feature and added its configuration file.
  • The offline option was selected in the Network menu of chrome dev tools for simulating a real-life network situation. After reloading it again, keeping the "Offline" checked, it was still able to load the page quickly because it had cached all the static assets during the previous loading instance.
    OfflineCache

Copy link
Member

@Shekharrajak Shekharrajak left a comment

Choose a reason for hiding this comment

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

Thanks for your PR for improving the application loading.
There are few other good concepts that can be used :

  • Lazy loading
  • Compressing the images
  • Updating the latest packages to latest version
  • Build optimization flags, production flags in build command

What do you think ?

"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
Copy link
Member

Choose a reason for hiding this comment

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

It is a good idea to add static images and files in cache memory. But isn't service worker works with https-server ?

We will love to see it working once we get the surge deployed URL. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@Shekharrajak I'm glad you asked this. There is a ngsw.json which manages app's versions. Whenever a developer changes files locally, this file's version changes. Whenever, a user on the client side reloads his page, first only the request for ngsw.json would be made. If only it's found same, no other requests for files shall be made, else requests for new (or updated) files are made. Hence, an improved loading speed.

Yes, this would work by serving the production build using http-server.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this would work by serving the production build using http-server.

So how did you tested it? I am curious to see the loading speed difference and check this out in http://pr-101-evalai.surge.sh/

Can you test it by changing some content and serve it again ? Offline it would be showing old content and after running the server again and after refreshing the page it should be able to update the changed content.

@codecov-io
Copy link

Codecov Report

Merging #101 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #101   +/-   ##
=======================================
  Coverage   53.43%   53.43%           
=======================================
  Files          55       55           
  Lines        2358     2358           
  Branches      253      253           
=======================================
  Hits         1260     1260           
  Misses       1023     1023           
  Partials       75       75

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69ae0ff...9a28cd1. Read the comment docs.

@RishabhJain2018
Copy link
Member

Let's keep it on hold for now. We need to revisit this later for sure before launching v1.

@RishabhJain2018 RishabhJain2018 added the work in progress This pull request is still a work in progress. label May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
work in progress This pull request is still a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants