Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does this cause the HTML sent over the wire to be bloated, i.e. the svg for the same icon could be repeated multiple times on the same page?


They say they don't inline because it doesn't make sense in their case, but if you do inline and use xlink [1], you don't duplicate data transmissions.

There are other techniques for client side-templated sites that will cache SVG icon data. For example, angular material's icon service [2] does this.

[1] https://css-tricks.com/svg-sprites-use-better-icon-fonts/

[2] https://material.angularjs.org/latest/api/service/$mdIconPro...


I expect that gzip would make the over the wire price for repeated icons insignificant.


Yes and no.

The repetitions would have to appear within 32KB of each other to be captured in the DEFLATE window [1] which, given that a lot of pages can be 100s of KBs of uncompressed text, may make that impossible.

Additionally, the zlib (or whatever) compression settings would have to be set aggressively enough to identify those duplicates as the best run-lengths to encode. Since GitHub is generating a lot of this live and delivering with low TTFB, they may be using a less aggressive than necessary setting.

[1] https://en.wikipedia.org/wiki/DEFLATE#Duplicate_string_elimi...


I could see this being an issue for a highly complex vector shape. But most shapes only consume a few bytes. Compared to an external image or another request for the font files.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: