DEV Community


Discussion on: How we improved website performance by 24% with 3 unusual changes

pavelloz profile image
Paweł Kowalski

Also, normally i wouldnt even mention this, but i think this is one of those rare cases where looking at the DOM depth and size could be a good investment if you look into performance issues.

Im a big fan of svg, but im not entirely sure that copying whole SVG tree every time its needed on the map is the way to go - if there is a big DOM tree with a depth, light png might be first easy step to make it a little bit shallower. But its very possible that with react and all that, its possible that your wiggle room will be small.

swissgreg profile image
SwissGreg Author

Hey Paweł,

Thank you for the detailed suggestions, appreciate a lot!

Addressing your points:

  1. We are using Create-React-App, not sure if it supports dynamic imports without a custom webpack config, will have a look.
  2. Gonna try purgeCSS, looks like fun :)
  3. Already doing DNS-prefetch.
  4. I thought that the fonts are already optimized - we use something like: nunito-latin which should already be stripped down to only latin characters - or is it possible to go further?
  5. Good point, will look into unnecessary DOM elements.
  6. What do you mean exactly with the SVG tree copying?
Thread Thread
pavelloz profile image
Paweł Kowalski

Fonts: ouh yeah, you can strip it down to characters you need - its very effective.

SVG - inlined svg is just a bunch of xml tags, so for 20 (even the same icons) your dom has 20x copy of that xml structure. I presume tiny png would be much flatter and i saw that you dont zoom/animate/manipulate icons on the map, so its less of a sin to migrate. Second option (probably better) would be to use svg symbols and use tag, to not duplicate the tree.