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

App is getting slow with many plants #94

Open
matthijsthoolen opened this issue Aug 3, 2020 · 2 comments
Open

App is getting slow with many plants #94

matthijsthoolen opened this issue Aug 3, 2020 · 2 comments

Comments

@matthijsthoolen
Copy link
Contributor

I have added a lot of plants to the app, 92 and still have to add some. But the app is extremely slow in the first load, up to a few minutes before the first image is shown. I already optimized this quite a lot by compressing all images (and creating thumbnails for the overview, and larger images for the detail pages), this saves both space and bandwith (feature 'request' 1).

The second problem is the large amount of request that are getting send to the firebase, for every plant 2 request are created. They are all executed before the first image is rendered. I don't have enough experience with firebase and/or vue.js to find the correct solution for this, but to me it seems that there must be a way to optimize this. By combining requests, or by using lazy-loading.

If you have any ideas on this, happy to help implement it

@morkro
Copy link
Owner

morkro commented Aug 4, 2020

Yes, this is a major problem. I also have a lot of plants added and it slows down considerably. With v2 I am planning to address this and have made a few minor improvements overall but haven't found a good overall solution just yet. One of the problems is that I don't really know how to reduce a) network requests and b) speed them up.

The current flow for a) is as follows:

  1. Make a request to get a collection of all plants (and their IDs)
  2. Iterate over collection and make an additional request per plant to get the full data
  3. At the same time, another request to get the image URL per plant

A few ideas that come to mind:

  • Store list of plants in localStorage, gets rid of first request (already done in v1, still not optimal as sync takes a while)
  • Create additional thumbnails per plant (in Firebase via functions) to speed up load time on Home, only load high-resolution on detailed plant view
  • Investigate if Firebase API could be used differently (e.g. queries)
  • Look into different Firestore database pattern (e.g. optimised documents/collections)

Since v2 isn't released and finished yet, I want to fix this for the new release. Happy for any help on this :)

@morkro
Copy link
Owner

morkro commented Aug 24, 2020

I have found a good improvement, which is currently implemented in v2. It refactors Firebase API usage and leverages a Web Worker for fetching images in another thread. This speeds up the load time immense and on my own account I get a load time of 1sec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants