Live data from Hacker News

Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

pixelambacht.nl

101–110 of 156 posts

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#101

Earlier quoted context omitted.

For my blog, I embedded all my webfonts into my CSS using base64 data URIs. That CSS is 100k, but my server gzips it to 72k, which is not much bigger than the CSS without the fonts + the fonts separately. Because I don't have HTTP2 yet, fewer requests make it faster (especially considering HTTPS), despite the extra size.

If you’re talking about https://theandrewbailey.com/blog/ then your CSS with and without the base64 encoding looks like this: 101K 9 Dec 18:30 with.css 99K 9 Dec 18:31 with.min.css 73K 9 Dec 18:31 with.min.css.gz 6.8K 9 Dec 18:30 without.css 5.2K 9 Dec 18:31 without.min.css 1.8K 9 Dec 18:31 without.min.css.gz Although this might be true: > …72k, which is not much bigger than the CSS without the fonts + the fonts sepa…

Thanks.

One advantage of embedding the fonts is that it eliminates FOUT. If the fonts were split out, once the fonts were loaded, the page would need to be re-rendered anyway. I don't see much practicality of rendering an already light page if it's going to be re-rendered differently quickly after.

By embedding the fonts, I've optimized for latency in downloading fewer files over HTTP1. Even a 2k CSS and 20k-ish font are hardly worth the cost in opening the connections; a 73k all-in-one is more efficent. Let's assume a reasonable 8mbit connection and 50ms RTT.

To download the 72k CSS on a new connection (because it's early in the page load), that takes 100ms to establish TCP and HTTPS handshake, and 122ms to download the 72k embedded font CSS, total: 222ms (at least, not including processing overhead).

For the split version: 100ms for handshakes, and 52ms for the 2k CSS transfer. Here, the browser might keep it open to download one (the headline font) (negligible load time for a open connection), and open another connection for the body text font. (the third monospaced font is rarely used.) The open one would download one 23k font in 73ms. The other connection (in parallel) will take 100ms for handshake, and 73ms for another 23k font. total: 325ms (at least, not including processing overhead).

For higher bandwidth connections, bigger files make even more sense. For split files to truly win, latency will need to be impossibly low, which for the hosting from my apartment basement (even on 150mbit fiber), is impossible.

Even though it's render blocking, browsers will continue loading other assets anyway. A mostly (if not fully complete) page will show the first time, often within a second on wired connections.

> I hope this comment is taken in the spirit it’s intended: I like making the internet fast :)

Yup. Me too!

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#102
post #35
post #28

Is the 2000TB/day number reasonable, or just clickbait? It's all based on coming up with two numbers that when multiplied say that this resource is downloaded 73 billion times a day. That's 20 times / day for every internet user (even those using it on a 2G connection once a year). Given a reasonable caching period of 1 month, that'd mean the average user visits 600 different sites a month. That seems like much more…

By renaming the CSS file from `font-awesome.min.css` to `fa.min.css` they could save 660GB a day: 73,000,000 sites * 1000 visitors * 10 bytes / 1024^3

my build task makes sure that every file on my site has only one character in the name!

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#103
post #45

Earlier quoted context omitted.

> For starters, leveraging caching via a common CDN pretty much requires everyone to be using a single version from a single CDN. If you can't agree on that, then every time a new version comes out the web is split and the caching doesn't work, and every time someone decides to use another CDN (or someone provides a new one) the group is split again. All this common web stuff that is distributed by several CDNs (as w…

Because anything that can cross domains instantly allows anyone to probe your browser to see what is in your cache. So to take it to a bit of a rediculous (but still possible) point, I could probably guess what your HN user-page looks like to you. So from there I could serve that in an AJAX request to all my visitors with this content-based hash and if I get a hit from someone, I can be pretty damn sure it's you. And…

Ideally this would be used with a sort of `Cache-Global: true` header in HTTP, and then you would only be able to grab things that are intended to be cached like this. It would do nothing to stop super-cookies with this method though.

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#104

There are some really valid points in here and I dislike the idea of using the whole font when only a few icons are required. But, isn't subsetting going to result in users now caching your subset instead of a cached copy of everything? I would think that does more harm than everyone grabbing a fully cached copy once from a cdn.

Usually when I want to use under 10 icons, I just download an image of each with this handy tool: http://fa2png.io (not affiliated, just a user)

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#106
post #90

Earlier quoted context omitted.

A calculator for you, because I'm in pitch-my-side-project mode ;) https://instacalc.com/50060

That's pretty neat idea. The site's missing a cute calculator favicon though, which destroyed my UX.

UX is now undestroyed.

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#107

Earlier quoted context omitted.

If you’re talking about https://theandrewbailey.com/blog/ then your CSS with and without the base64 encoding looks like this: 101K 9 Dec 18:30 with.css 99K 9 Dec 18:31 with.min.css 73K 9 Dec 18:31 with.min.css.gz 6.8K 9 Dec 18:30 without.css 5.2K 9 Dec 18:31 without.min.css 1.8K 9 Dec 18:31 without.min.css.gz Although this might be true: > …72k, which is not much bigger than the CSS without the fonts + the fonts sepa…

Thanks. One advantage of embedding the fonts is that it eliminates FOUT. If the fonts were split out, once the fonts were loaded, the page would need to be re-rendered anyway. I don't see much practicality of rendering an already light page if it's going to be re-rendered differently quickly after. By embedding the fonts, I've optimized for latency in downloading fewer files over HTTP1. Even a 2k CSS and 20k-ish font…

Hah, this is getting interesting. Would be more fun doing this over a beer, but…

> Let's assume a reasonable 8mbit connection and 50ms RTT.

This is a huge assumption; you’ll be neglecting almost all of your mobile users there. But! Optimise for your use-case, of course.

If you’re self hosting your fonts I would leave them external, `preload` them, and use the preferred `font-display` mechanism to deal with (or elimiante) FOUT and/or FOIT. That’s your extra connections taken care of, and we’ve moved fonts back off of the critical path :)

I think what we’ve both hit upon here is the fact that browsers need to decide on a standard way of handling FOUT/FOIT. Leaving pages blank for up to 3s (or in Safari’s case, indefinitely) would completely eliminate the need to try and circumvent it by base64 inlining :(

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#108
One of the quoted sources is titled

>How Font Awesome 5 Became Kickstarter’s Most Funded Software Project

I checked their kickstarter, however. >35,550 backers pledged $1,076,960 to help bring this project to life.

Pillars of Eternity, most assuredly software, was a kickstarter I backed. Their campaign page reads to this day:

>73,986 backers pledged $3,986,929 to help bring this project to life.

Why make up such a shitty lie? Does it matter if you have the longest John in the pub? Is this something USA specific down the American Dream/Meritocracy/Competitiveness axis? I find most European projects to be more modest about these things.

No hate please! None intended here. It just feels weird to me.

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#109
post #10

Earlier quoted context omitted.

Icon fonts have been breaking websites for people that do not allow websites to set their fonts.

Are those the same people that disable JavaScript everywhere too? Imagine that you were running desktop apps and said "ok I want this program, but I only want it to use standard widgets, my chosen font, and not use certain API's. Wait why does this look funny and not work right?!"

It seems worth noting that as web browsers have removed the ability to disable JavaScript they have added options to disable web fonts. I flipped this switch in Firefox for Android because it makes pages load noticeably faster and conserves data. Lots of sites seem to host web fonts on third-party CDNs which require a separate TCP connection: a big deal on high-latency mobile.

Blocking web fonts usually does not noticeably degrade a site's usability or functionality. Icon fonts are the exception. I've learned that a question mark in the upper-right corner is usually a site's menu, except when it's the search function. I don't think that this level of breakage is comparable to what happens when JavaScript is disabled, since many sites just break completely without scripting.

Re: Saving the Internet 2000TB a Day: Fixing Font Awesome’s Fonts

#110
post #108

One of the quoted sources is titled >How Font Awesome 5 Became Kickstarter’s Most Funded Software Project I checked their kickstarter, however. >35,550 backers pledged $1,076,960 to help bring this project to life. Pillars of Eternity, most assuredly software, was a kickstarter I backed. Their campaign page reads to this day: >73,986 backers pledged $3,986,929 to help bring this project to life. Why make up such a sh…

Kickstarter separates video games from software. They're #1 in that section when sorted by funding.

https://www.kickstarter.com/discover/categories/technology/s...

Post reply on HN