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

performance issues #3

Open
lenmorld opened this issue Nov 8, 2018 · 7 comments
Open

performance issues #3

lenmorld opened this issue Nov 8, 2018 · 7 comments

Comments

@lenmorld
Copy link
Owner

lenmorld commented Nov 8, 2018

searches are very slow

  • searching with Spotify
    -- this could be caused by latency in API key requests, and search results turnaround time

  • UI loading of each Item very slow
    -- this could be due to frequent re-rendering of Item for EACH and EVERY prop, state change
    ---> use some kind of caching, look into memoization

General React optimization
https://reactjs.org/docs/optimizing-performance.html

@lenmorld
Copy link
Owner Author

lenmorld commented Nov 16, 2018

PRIORITY #1
the lag is very obvious

  1. Spotify embed iframe
    options:
  • put iframe in its own component and never re-render if Item stays visible
  • re-render once and save the DOM element somewhere (but it's a rendered external page, might not be possible)
  • CSS tricks 🐵 display:none on filter
    Since embed is already loaded, no need to re-render it, just hide it on filter
    ✔️ worked! easy optimization

@lenmorld
Copy link
Owner Author

lenmorld commented Nov 16, 2018

  1. override shouldComponentUpdate in List and Item
  • need a good algorithm to decide when not to render, esp. the Item

or extend React.PureComponent

https://www.robinwieruch.de/react-prevent-rerender-component/

@lenmorld
Copy link
Owner Author

  1. memoization
  • there are some good libraries out there
    but it's better to build our own for a small app

@lenmorld
Copy link
Owner Author

  1. SSR (server-side-rendering)
    also good for SEO

@lenmorld
Copy link
Owner Author

  1. Caching in localStorage
  • what to cache? we don't have a lot of data yet, caching may be premature opt
  • if we can catch Spotify embed divs, that's the best

@lenmorld
Copy link
Owner Author

  1. functional components vs class components
  • not a lot of evidence in performance benefits, but some memoization patterns require functional components

@lenmorld
Copy link
Owner Author

  1. webpack and Babel optimizations

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

1 participant