anchvy's website logo

Memo: Web performance runtime Q&A

I have watched the https://www.youtube.com/watch?v=b-osLoWii2M and here is the interesting information I've got from this video~

Q: How do we make our local development env fast? I am constantly loading and reloading 80MBs of un-tree-shaken js

  • Loadable component
    • lazy loading technique, in case that we are using on prod, it will be benefit on develop too
  • Http caching
    • If we set up a good caching, that mean if there is no change, we dont need to pull that file from a development server on every reload
    • Using etag based on node_module version / hash / last modifiled time for caching. So, the browser can also help caching this and we can potentially skip the parsing javascript process. (Also, download time can be reduced)
  • Make development as similar to production as possible
    • Sometimes, there is a build process that take too long time on development build but we can also find the bottleneck and fix it.
    • we can have more confident that it will run the same way on prod
  • Typescript incremental mode
    • make it faster on repeat run
  • Esbuild (build tool)
    • plugins are not ready yet but it's very fast

Q: Do you optimize as you are developing the website / web-app, or do  you wait until the end, profile, and then do rounds of optimizations?

  • Profile as they go, but often go with make it work, make it right, make it fast because sometimes, we just lose time optimizing something that in the end, we have to thrown out bcause it does not fit in their program in the end
  • Prefer to keep an eye on performance but dont waste the time on opitimizing a minor thing (e.g. For loop) if it does not break the frame or being a bottleneck
  • Waiting for a while to see how did that payoff 
  • Did not do the profiling but test it on low-end phone (So, we can know how it performs)

Approaches:

  • using experience to make a decision on what we should do or we should not do
  • selecting technologies that have a good affect and able to predict the long term for performance 
  • using static render

See full video: https://www.youtube.com/watch?v=b-osLoWii2M

Latest articles!

CSS: PX to REM Calculator

Memo: What I can see from POPCAT.CLICK as a Frontend engineer

VSCode Tip: Find all usage of specific variable across files in workspace