4 ms·
> Especially things like removing as much whitespace as possible or replacing true/false with !0/!1 just don't really save a lot of space. At the scale of Wiki
by mschuster91 3y ago
> Especially things like removing as much whitespace as possible or replacing true/false with !0/!1 just don't really save a lot of space.
At the scale of Wikipedia (~10 billion pageviews a month), even a single byte saving can mean terabytes worth of bandwidth saved.
- distcs 3y ago> At the scale of Wikipedia (~10 billion pageviews a month), even a single byte saving can mean terabytes worth of bandwidth saved. But does it really move the needle anywhere where it matters? If you are serving a million bytes in every response but you manage to trim a single byte from it, I don't think it is going to move the needle anywhere. Sure it will save a terabyte when you have served a trillion responses. But in a trillion responses you are saving only one terabyte out of an exabyte of responses. That's not much!
- bawolff 3y agoAlso keep in mind that for big web properties bandwidth is sold very differently than it is to normal consumers. In many cases wikipedia probably isn't even paying for bandwidth due to peering agreement. As far as performance goes, i suspect whether a single byte matters depends a lot more on if the extra byte results in the same number of packets or not.
- djbusby 3y agoSo, why use two bytes for '!0' when just '1' works?
- tinyhitman 3y agoIts not strictly the same. '1' is a number whereas '!0' is a boolean.
- ilyt 3y agoI hate that language a bit more now
- hn92726819 3y agoBoth 1 and true are truthy, but not the same. That would work if the variable was only ever used in if(x), conditions, etc. Stringifying won't produce the same value either when passing values as well.
- cmg 3y agoBecause 1 !== true and 0 !== false in JavaScript: const index = "Hello HN".indexOf("H") console.log(index); >> 0 index == false >> TRUE index === false >> FALSE
- foobarbecue 3y agoI see this type of reasoning a lot and it feels like it should have its own named fallacy. A tiny percent savings on a huge cost is a moderately big number, yes. The problem here is that you've switched from proportional thinking to arithmetic thinking in the middle of the thought. In most cases, if you started with proportional thinking, you should stick to it. Example of the fallacy: 0.1% of my salary goes to avocado toast, which might not seem that much, but over ten years, that's a thousand dollars! The fallacy here lies in the fact that a thousand dollars is insignificant over 10 years, but the statement makes it feel significant by switching from proportional to absolute. "The avocado toast fallacy"?
- fiprofessor 3y agoYes, but sometimes switching to arithmetic/absolute thinking is the right thing to do. For example, suppose an engineer who is paid $200k per year can spend a week to implement an optimization that reduces costs by 0.1%. If that is 0.1% of something that costs $50 million per year, then that's not a bad use of time.
- distcs 3y ago> For example, suppose an engineer who is paid $200k per year can spend a week to implement an optimization that reduces costs by 0.1%. If that is 0.1% of something that costs $50 million per year, then that's not a bad use of time. Is it not? I don't know. I don't run a multi-million dollar business. So this is an honest question. 0.1% of $50 million is a meagre $50000. If someone is running a business that is spending $50 million per year on something, are they really going to care about a small $50k saving per year?
- fiprofessor 3y agoWell, it's not worth it to bring this optimization to the attention of the CEO. But it definitely exceeds the engineer's weekly cost by a lot, so if it only takes a week, it's potentially worth it (modulo opportunity costs for other things to work on). Spin it around: is it worth it for a sales person who makes $200k per year to spend a week to land a $50,000 per year contract? I think it potentially is, for the same reason, even if the organization as whole makes hundreds of millions of dollars a year.
- arp242 3y agoYou're right, at some scales it does add up in a meaningful way, and making an informed decision based on that is entirely reasonable. However, most people operate nowhere near that kind of scale, and don't make an informed decision about this.
- tleb_ 3y agoAre absolute numbers important in such a case? Percentages seem more appropriate.
- ilyt 3y agoTerabyte/month is around 3Mbit/ sec Remember kids, if someone tries to use unusual time interval (like months for bandwidth-related stuff), they just want to make a small number look big
- dgb23 3y agoIs that correct? I get a larger number. In either case, they said a single byte saved. Any amount of minification is going to save more than just a byte. It’s also incredibly low effort to do so.