Re:Self-host your fonts for better performance
by marcus_holmes on Friday December 04, 2020 @05:44AM
(#25300955)
I've sped up sites before by using inline svg rather than icon fonts - downloading an entire icon font for a few icons is inefficient when the actual SVG needed for those icons is < 1Kb and is waaay faster as inline SVG.
[ Parent
| on HN ]
Re:Self-host your fonts for better performance
by foxhop on Friday December 04, 2020 @07:51AM
(#25301688)
Remarkbox does this with the default profile avatar, just-in-time dynamically rendered and inlined SVGs.
I've considered storing each default SVG into the user table and then inlining in the HTML but decided to wait on that optimization since inlining dynamic SVGs itself was such a significant speed boost, especially on threads with hundreds of comments.
Without inlining, each profile image or SVG would be a separate request parallel HTTP request and often at least a couple requests would be slow.
Re:Self-host your fonts for better performance
by hypertele-Xii on Friday December 04, 2020 @10:04AM
(#25302973)
It's only faster on the first load. On all subsequent loads its slower and consumes more bandwidth. I find this irresponsible.
Re:Self-host your fonts for better performance
by marcus_holmes on Friday December 04, 2020 @04:43PM
(#25308495)
1. If you use, say, 5 icons and there are, say, 250 icons in the full font, then you would need to download the page 50 times to just equal the bandwidth. That's assuming the cache doesn't expire, or it's not an incognito session, or you're not loading it from a CDN where it won't get cached anyway.
2. If you do find this irresponsible, then by all means create a small SVG file with the 5 icons in it and allow that to be cached, or even 5 small individual SVG files if it comes to that.