43 ms·
How can we, as web professionals, help to make the web more energy efficient?
- barry27 6y ago#FFFFFF
- tarsinge 6y agoIn standard web browsing how much energy is wasted due to tracking and data collection? I don’t have the number but in a typical newspaper websites > 50% of CPU / bandwidth / energy dedicated to JS marketing related stuff would not surprise me. If confirmed some bold actions would be a massive win win for the general population.
- mattlondon 6y agoA static site generator like jekyll or Hugo might be a good option if "real-time" dynamic content is not really needed - e.g. most blogs and news/magazine sites don't need to generate the page everytime (or even every so often then cache it). Just generate it once and serve the HTML. Nothing beats the feel of a static site loading in - so snappy and fast (especially if CSS has been adequately minified/bundled too).
- 4gotunameagain 6y agoRetire javascript The overwhelming majority of websites could be implemented with the exact same functionality with just html, and we are here because insane demand for websites created an insane wave of non knowledgable web "developers"
- donatj 6y agoCached server side rendering. I’ve been screaming for years, Why make a million computers do something (composite values into a template often with associated calculations) one computer could do ONCE and then share. Its fundamentally flawed design and it’s such a enormous waste of energy.
- mro_name 6y agoI'm surprised nobody mentioned http://idlewords.com/talks/website_obesity.htm http://idlewords.com/talks/website_obesity.htm nor https://solar.lowtechmagazine.com https://solar.lowtechmagazine.com
- LukeB42 6y agoTalk more about what regulatory pressures can be applied to help these companies evolve: https://theguardian.com/sustainable-business/2017/jul/10/100-fossil-fuel-companies-investors-responsible-71-global-emissions-cdp-study-climate-change https://theguardian.com/sustainable-business/2017/jul/10/100...
- throwaway7281 6y agoLess javascript?
- aaccount 6y agoStop programming like a bunch of clowns!!! Don't build websites on top of a million libraries which you don't need and put it in some container and host it in the cloud while using as much of the cloud service providers tools. Build as much as possible from scratch and host it close to metal as possible.
- swiley 6y agoSeriously! For the "client side": The web is responsive by default, making it not friendly to screen readers/phones takes extra work. Semantic forms are great. You're writing a machine readable description of an API that auto generates a GUI. Theme it with some CSS and leave it alone. No one likes downloading piles of javascript to load text documents.
- masswerk 6y ago> The web is responsive by default, making it not friendly to screen readers/phones takes extra work Oh, the irony of the iPhone. When it was launched, its unique proposition was that it was the only phone which could render normal webpages, while previously specially tuned XHTML code and handheld stylesheets were required. And what did we do with this? We started the era of specially crafted mobile sites and mobile first.
- paulryanrogers 6y agoIIRC it was more because of screen size and finger input. I had a Treo before an Iphone and the stylis made liquid/responsive sites very usable without huge buttons. Still, both then and now mobile requires reducing options to avoid lots of zooming and panning. And less JS is better.
- jordache 6y agoYou are not getting it. Cross device compatibility is not a simplistic notion that the desktop ui just needs to reflow and scale down into a smaller screen. Properly done multi device support will recognize different “job to be done” in mobile vs desktop. If approached the problem space in this way, then you end up with different ui in mobile than desktop, for many applications
- secondcoming 6y agoI was working next to my smart meter one day and noticed that doing a code build (C++) increased my PC's power consumption by ~50W. Enthusiastically dragging windows around the desktop seemed to cause little spikes too which I assume is caused by my graphics card.
- soulchild37 6y agoUse less javascript framework lol
- ExcavateGrandMa 6y agoeZ, SHut it off :Ð
- eitland 6y agoMany good points here. I know webpages I had to use for months that would eat my laptop battery if left alone (log in screen for a wifi network that scrolled the background, eating a full processor core and also search results page when using Firefox and Google).
- Izmaki 6y agoOne goal that covers all suggestions: reduce advertisement.
- eplanit 6y agoStop including megabytes of javascript in every page, and composing pages from 100s of requests to microservices. In short, keep things simple.
- onion2k 6y agoHere are two utterly trivial examples of some JS; for (let x=0; x < 10000; x++) { if (x===0) console.log(x); } versus for (let x=0; x < 10000; x++) { if (x===0) { console.log(x); break; } } The second one is more code but much more efficient. Having a smaller amount of code doesn't translate in to having faster or more efficient code. This is the basis of most optimization work - you're optimizing code to do the minimum amount of work, and very often that means writing more code. A moderately complex React/Vue/Svelte app will be much more energy efficient than a naive vanilla JS alternative because most frameworks to clever and hard things to reduce the amount of work that's done in order to increase performance, and a side effect of that is using less energy.
- uberswe 6y agoIf you write it from scratch you could just get straight to the point with console.log(0);
- Trowter 6y agohttps://motherfuckingwebsite.com/ https://motherfuckingwebsite.com/
- Shared404 6y agoA series of websites everyone should read at least once.
- antegamisou 6y agoQuite possibly the only "plain" HTML website with an SSL cert I've ever came across.
- Pfhreak 6y agoWait, design is the big energy hog? I find that... well, in need of some evidence and data. I was expecting something like using serverless, or serving only static content or something. There's just no way that "write less JavaScript" is the big needle mover compared to right sizing and scaling your fleet. Right? Also, rather than spending two days optimizing all this, wouldn't you see much more carbon removed by spending two days planting trees?
- Shared404 6y ago> Wait, design is the big energy hog? I find that... well, in need of some evidence and data. Is that a reason not to try to make things more efficient? > There's just no way that "write less JavaScript" is the big needle mover compared to right sizing and scaling your fleet. Right? My understanding is that it's less "write less JavaScript" and more "Don't pull in MB after MB of dependencies". Also, that was just one of several points made by the author. > Also, rather than spending two days optimizing all this, wouldn't you see much more carbon removed by spending two days planting trees? Por que no los dos? As a result of the author having done so, it has now saved others who are interested in doing so time learning how.
- ehnto 6y ago> My understanding is that it's less "write less JavaScript" and more "Don't pull in MB after MB of dependencies". Probably good practice regardless. Recently saw a project with 23,000 lines of CSS thanks to pulling in library after library. That's just hard to reason about come maintenance time.
- Pfhreak 6y agoYes, it's absolutely a reason to consider not making something more efficient. It's not free to do the things this author recommends. Increasing efficiency has both a cost (how many hours did it take to improve this, and how much power was spent on competing to develop them) and and opportunity cost (what could we have spent those hours on instead). If the efficiency gain never repays the cost, you've actually made the system worse by making it more efficient. There are no claims from the author about what is saved, it seems like the amount of energy spent reclaiming a small amount of energy will lately be worthwhile.
- jimbob45 6y agoSo the solution is more minimalist web design? No thank you. I’m quite over stripping down websites to their basest functionality.
- jamil7 6y agoTheres a line of thinking that suggests the form and aesthetics of systems or products should be a result of their functionality. Highly functional websites can still be efficient. A start would be to remove all the marketing, advertising and tracking garbage attached to them and optimise from there.
- elliotbnvl 6y agoStopped reading here: > “But Carl, some of us don’t have the luxury of building super high-performance, lightweight, and optimised sites due to client budgets and deadlines.” Well, I think you need to work on your craft, change your attitude and your priorities, or find another profession. He may have a valid point, but I’ll never find out as this attitude has turned me off finishing the article.
- thatcodingdude 6y agoSame here, that came off as really privileged.
- dusted 6y agoStop using javascript. Stop using CSS or color. Don't put any images in the document that are not important to the content.
- mcv 6y agoColor is actually relevant. Dark mode can save a lot of energy on OLED screens.
- dusted 6y agoColor should be dictated by the users browser, not by the website author, if the user wishes a dark background with light-grey text, they can configure their browser to display webpages with such a color scheme :)
- noisem4ker 6y agoI fully support this principle.
- tluyben2 6y agoYeah so make everything white on black.
- DoingIsLearning 6y agoOne thing that I struggle with, as someone who is not a policy maker, is understanding the proportion of carbon emissions associated with different activities, for example, what would be the carbon emissions savings of these different options: - The yearly energy savings of optimizing millions of web pages to reduce server side and local energy consumption? - Banning personal vehicle diesel engines for 12 Months? - Not shipping tonnes of tropical food across the Oceans for 12 months? - Everybody not buying new clothes for 12 Months? - Everybody not buying a new electronic device for 12 months? I am not claiming that we should all go amish and bankrupt entire sections of the economy, my point is, these are all direct ways to curb carbon emissions but I have no intuition of how big of a dent in the overall emissions each option would make. What are the carbon emissions that, if curbed, would provide the most bang for buck if you will?
- lowwave 6y agoAnd also don't forget to include Carbon emission emitted by natural event such as volcano eruptions
- jakecopp 6y agoI think we should create a carbon/pollution tax and let the invisible hand of the market figure that out - it's too complex and there are so many side effects to adjusting things by brute force!
- londons_explore 6y agoA carbon tax implemented by a "world dictator" would work. Any individual country implementing a carbon tax doesn't work because they put themselves at a big disadvantage, and goods and services go across country borders, taking with them almost-impossible to fairly calculate amounts of carbon. The biggest things the world could do towards the "world dictator" approach would be: * Have a consortium of countries implement a carbon tax, while taxing all inbound goods from countries that don't tax carbon. * Adjust WTO rules to allow taxing imports based on estimated carbon content. * Have the WTO decide which countries are "on track to meet carbon reduction targets". Allow taxes on imports from any country that isn't. * Allow countries to "sue" another country for environmental damages. When they don't pay up, have a UN court able to threaten anything up to military action/takeover of the country's leadership to get payment.
- tannhaeuser 6y ago"Web professionals" - therein lies part of the problem: to turn a simple mechanism for self-publishing into an idiosyncratic ever-changing self-serving cottage industry.
- cel1ne 6y agoUse CDNs for delivering JavaScript libraries instead of including everything into custom bundles. React could be transferred ONCE to the browser-cache instead of hundreds of times.
- youngtaff 6y agoThis isn't effective as browsers partition the cache using a double (or triple) key of the document origin and third-part origin. Safari started this and Chrome is following - https://andydavies.me/blog/2018/09/06/safari-caching-and-3rd-party-resources/ https://andydavies.me/blog/2018/09/06/safari-caching-and-3rd... So with a public JS CDN React would be still transferred multiple times. Using a custom bundle is probably more efficient as it should compress better resulting in lower download sizes (bit often modern bundles are huge so I wouldn't rely on this point)
- jillesvangurp 6y agoIMHO it's the wrong problem to fix. My view is that the best way to speed up the transition to clean energy is to vastly increase demand for electricity. This causes people to invest in new energy production. Which at this point pretty much means more wind and solar gets added. The more we have of it the less important remaining coal and gas plants are. Many countries are nearly done shutting down their coal plants. Gas plants are still being built but the economics for that are also not looking great at this point. Once we have a robust clean energy grid, these will probably be mothballed as well. Data centers are already mostly running on clean energy and in so far they are not, all big cloud providers have committed to being carbon neutral. So, if you have some solar on your roof, you basically could be browsing the web without expending any carbon. So, open some more tabs and stop worrying. In any case, the web is a tiny portion of our overall energy consumption so it's not really worth prioritizing this for optimization. Best case, it won't make a lot of difference. Worst case you are sacrificing design and UX for something that ultimately doesn't matter in terms of tangible results. Of course, there's nothing wrong with making laptop batteries last longer, making laptops run cooler, and delivering a web site that is fast and responsive.
- ajkjk 6y agoThis is a mild example of a type of argument that I like to call "destructionist": to save something, destroy it as fast as possible so we have to deal with the consequences sooner. I've seen it applied to climate change: save the earth by ruining it! It's fallacious, though. If you can save it later, you can save it sooner, and if it's worth saving at all, sooner is better. It's not an argument for a _solution_, it's an argument for _finding the will to implement the solution_ -- and it's the "minimally moral" argument for that. "Rather than do anything that takes moral strength, just make the problem worse and let other people deal with it!" The only worse stance is to no longer want a solution at all! Of course it does seem like the real problem isn't figuring out what to do, but convincing people to care enough to do it. But our collective human intellect ought be able to do better than this.
- jillesvangurp 6y agoIt's an economic argument; you are making a moralistic argument. Economics have achieved more in the last five years than decades of moral outrage over climate change. I'm simply stating that increased demand for energy is currently being met (almost exclusively) through clean energy. Speeding that process up through more demand (which we have anyway) also speeds up the process of shutting down dirty capacity. This is why coal is rapidly disappearing from most countries still operating coal plants. Unthinkable ten years ago, and yet nearly completed in some countries right now. Even the US is on a clear path to probably be completely coal free very soon. The problem is not the demand but the dirty and expensive supply. I'm simply arguing to fix the supply problem by flooding the market with clean alternatives. The fastest way to do that is simply increase demand.
- dehrmann 6y agoI'm trying to find a good source, but on phones, data size isn't as much of an issue as how long you have to keep the LTE radio powered for a full data connection. The worst thing you can do is progressively load content every 60s as someone scrolls or ping back to a tracking server every 60s.
- mjevans 6y agoJust, put the content that needs to be there out and as little else as possible. If downloading less (off page stuff) is important for a CLIENT device to do, it will do the lazy loading for you. If loading it or not matters the client will do so. (Anywhere that just pulls it all down is still going to do the same thing; since that's the easiest way when it doesn't matter.)
- mbgerring 6y agoThis is an important and timely call to action but I think the more important audience here is ad tech professionals. The difference between my processor fan turning on or not is frequently ad tech.
- Nextgrid 6y agoAdvertising is a cancer that needs to be eradicated; it not only wastes energy but also human time.
- dehrmann 6y agoNot the web, but abandon Bitcoin.
- josalhor 6y agoI came here to say exactly this. For reference, Bitcoin electrical energy consumption is (conservatively) estimated to be about the same as Belgium (yes, the country) [0]. [0]: https://www.sciencedirect.com/science/article/abs/pii/S2214629620302966?via%3Dihub https://www.sciencedirect.com/science/article/abs/pii/S22146...
- paul_f 6y agoThe amount of power dedicated to Bitcoin mining dwarfs anything just about everything else we can do as coders. It's embarrassing really.
- ulisesrmzroche 6y agoThis is true but it’s one of the sacred cows here in HN so crickets
- kstenerud 6y agoMy first step is https://concise-encoding.org https://concise-encoding.org All of this constant stringification/destringification just for another machine to read some transmitted data is massively wasteful, but we all do it because we want our data to be human readable, so we use JSON. But what if you could send as binary, with the ability to convert 1:1 to/from text only when you needed a human to inspect or input the data? What if you didn't need to encode all of your non-numeric data into strings? I've got many other steps in the pipeline to reduce our energy wastage, but this first one has taken awhile (3 years), and I still need more eyes on it to make sure nothing gets missed before I release in a few months.
- layoutIfNeeded 6y agoSomeone cue in the appropriate xkcd about n+1 standards.
- harshitaneja 6y agoProtobuf?
- kstenerud 6y agoProtobuf is solving a different problem than the JSON, BSON, XML style ad-hoc data encodings. It's also not human readable.
- RcouF1uZ4gsC 6y agoStop using Python, Ruby, Pho
- 4140tm 6y agoI'm not a huge fan of putting client-side rendering on everything, but I still feel it's unfair and shallow to put so much blame on it. For an app getting more than a couple page views in a session, a SPA solution may provide significant savings on rendering and db queries. Combine that with resource caching and these effects extend to following sessions. That is, of course, if the app was built with some consideration regarding overall performance. Unfortunately, not too many web developers (both FE and BE) seem to be overly concerned with efficiency.
- ogou 6y agoI don't believe asset and component delivery are the energy hogs this article implies. Actual computation uses more energy. Youtube transcoding the 500 hours of video it gets every 60 seconds uses much more power than too many unoptimized PNGs do. We live in a time where people will run their car to charge their phone. It's not js packages. The inefficiencies are in the chair, the users chair.
- II2II 6y ago> The inefficiencies are in the chair, the users chair. If that is the case, then optimize for the user so they aren't running their car to charge their phone as often (or other such craziness). My biggest problem with the article is the failure to quantify the energy use of these optimizations. Sure, it is difficult to do since there are so many variables and most of those variables are difficult to generalize. On the other hand, it should be possible to come up with relative measures to facilitate the optimization process. For example: when is it better to do something on the server vs. on the client? When will the decision even matter? Of course, the suggestions offered by the article are also varied in quality. Some clearly offer better energy efficiency for both parties, such as not adding elements that you do not need. Others may indirectly benefit both parties: doing more server side processing on a popular website is going to benefit the consumer, but it also forces the provider to consider the cost of added overhead. Some simply have questionable merit, such as optimizing the size of resources that are infrequently used. Others are of dubious merit, such as the tendency of SEO to be used to find the provider's content rather than what the consumer needs. It is a much more complex issue than can be addressed from a few quick tips.
- ChrisMarshallNY 6y ago> The inefficiencies are in the chair, the users chair. PEBCAK[0] Personally, I still like to optimize my pages. I learned Web design, at a time when pages were supposed to be about 50KB, or less. That seems quaint, these days. I use a lot of GIF and PNG8 images, and use CSS gradients and effects. I’ll do things like make a rollover image as a GIF in two parts, and use CSS to move the background image. Makes for a zippy rollover. But I’m still beholden to my site framework or theme, loading 1MB of useless JS and CSS for every page. Some of the new site builders, using things like Jekyll, are nice, but take more time for me (I am not actually a Web designer, although I have written many, many Web sites). As noted, the real hogs are on the big iron. We can write software and APIs to reduce CPU usage, but it’s a drop in the bucket, compared to the server. I think that server engineers are already doing everything they can to be efficient; simply because that confers a competitive advantage. But, also as noted, as long as there’s a vast demand for cat videos, there will exist, a vast cat video delivery infrastructure. [0] https://en.m.wiktionary.org/wiki/PEBCAK https://en.m.wiktionary.org/wiki/PEBCAK
- elihu 6y ago> "From data centres to transmission networks to the devices that we hold in our hands, it is all consuming electricity, and in turn producing carbon emissions. According to recent estimates, the entire network already consumes 10% of global electricity production, with data traffic doubling roughly every two years." That's interesting. It's more than I would have guessed. I assume that's dominated by the energy used by data centers and whatever devices the users are using, and that all the switches in between are relatively cheap to run relative to how much they're used? Anyways, my suggestion is the obvious one: turn off all that ad and tracking nonsense. That's incompatible with the business model of a lot of popular sites, though. A good fallback may be to encourage everyone to use ad-blockers.
- fxtentacle 6y agoQuite simply by becoming web professionals in the first place. All of the inefficiency examples create unnecessary cost or worsen the user experience. It's well documented that most people work better and more often with fast tools. And there's lots of regular folks complaining that fashionable hipster websites are horrible to use. And lastly, lots of Javascript also increases maintenance costs. So all of the points could be summarized as "don't make user hostile beginners' mistakes" Now the more important question is: which company actually values its users / customers enough so that they won't outsource to the lowest bidder?
- higerordermap 6y agoOnce upon a time Google cared a lot about performance of client facing application.
- pantulis 6y agoYes, this. All of the issues raised end up costing money and dollars are a great proxy for energy efficiency. If you can shave x$/month from the infrastructure budget, wether it's servers or bandwith, you are being greener.
- vertbhrtn 6y agoIs it like a competition in sarcasm here?
- RcouF1uZ4gsC 6y agoFor the backend, stop using Php, Python, Ruby and start using Java, Rust, or C++.
- gao8a 6y agoSometimes I recycle tabs instead of opening a new one :)
- nicbou 6y agoWorking from home would likely have a greater impact than anything else listed here. If I'm not mistaken, the internet uses as much power as all of Germany, or less than 100 million people. This makes our choices as individuals more important than our choices as developers. Drive less, fly less, consume less.
- dfischer 6y agoIt's less about the web and more about the computations we're running. The stack end-to-end is inefficient because software quality is lackluster and deficient of craftsmanship. This is mostly because the hardware enabled this type of behavior. The only way this is going to change is to change the hardware. I see this becoming possible as we transition to localized manufacturing where the individual only depends on themselves. So as we get closer to chip fab happening via a 3d printer, and all hardware and software being local, we'll be closer to the energy efficiency goal. You can see the trajectory already happening and IoT/Microcontroller/Etc boom. Lots of cool new projects are coming out with the "hacker-like" culture of old on energy efficient chips that can run amazing software powered by just solar alone. Super cool, I have faith we'll get there soon!
- matkoniecz 6y ago"entire network already consumes 10% of global electricity production" - [citation needed]. I keep encountering blatantly wrong claims like "10 largest ships pollute more than entire Europe" or "unplugging unused chargers is important" or "there is no global warming" or "global warming threatens extinction of Homo Sapiens" so often that I stopped treating such claims seriously, unless there are proper verifiable nonpaywalled citations.
- mrpopo 6y agoIt is a hard topic, as it will depend on things like life-cycle analysis of network devices, but if you google a bit, all reports are in the 7-12% range. Around 10% of the world’s total electricity consumption is being used by the internet, according to a recent research report from Swedish KTH. [https://insidescandinavianbusiness.com/article.php?id=356 https://insidescandinavianbusiness.com/article.php?id=356] Our best-case analysis shows a decline in consumption from 7.4% in 2012 to 6.9% of total global electricity consumption in 2017; however the worst-case shows a rise to 12.0% driven primarily by expansion of the network and data-center infrastructure. [https://aran.library.nuigalway.ie/xmlui/handle/10379/3563 https://aran.library.nuigalway.ie/xmlui/handle/10379/3563] See figure (ICT electricity usage 2000kWh).[https://www.nature.com/articles/d41586-018-06610-y https://www.nature.com/articles/d41586-018-06610-y]
- matkoniecz 6y agoVery interesting. I would expect it to be much lower. I wonder how much of this is wasted on cryptocurrencies.
- dredmorbius 6y agoRegarding pollution, a specific problem is where a specific pollutant is high relative to others. For shipping, bunker fuel emissions are modest in CO2, but high in particulates and extraordinarily high in S02 emissions. You can literally visually identify major shipping lane by such emissions, as here in the Indian Ocean: https://earth.nullschool.net/#2020/09/18/1000Z/chem/surface/level/overlay=so2smass/winkel3=74.35,0.47,842/loc=76.572,7.053 https://earth.nullschool.net/#2020/09/18/1000Z/chem/surface/... The thing is that there's a considerable set of commonly-tracked pollutants, with emissions varying greatly by source, as wwell as markedly different long-term and wide-are effects, some large, some small. The chargers claim ... is mostly bullshit, however. The claims may be both clickbait (misleading) and accurate (properly qualified).
- higerordermap 6y agoLot of developers don't care about performance at all. Knuth must be regretting his life choices when he knows webshits write O(n²) code when O(n) code would be equally straightforward, and allocate memory gratiously, misquoting "premature optimization is root of all evil". Most of them also have latest hardware and don't know the user experience / business consequences of this. Lack of knowledge of proper computer science fundamentals among blue collar developers is also a reason for this.
- kavi87 6y agoYou get what you pay for. I would blame companies first for asking fast deliveries of features at minimum cost. When you are not paid enough you have no reason to care about the performance of the software. I would go as far as to say that you would be an idiot to do so.
- dgellow 6y agoJust an idea: if we want to have an impact we should know what are the actual numbers, what is actually consuming energy. That could maybe be crowd sourced. Let’s say someone create a browser extension that does some voluntary analytics, such as counting requests, images and their size, video, size of scripts and styles. All of this gathered somewhere anonymously. If it’s done by a trustworthy group and people start using it, we could have good information that could be used to understand what are sources of energy consumption over time from the point of view of users. Again, that’s just an idea I got reading the comments here. And I know people here will dismiss it because of privacy concerns (that I mostly share).
- unnouinceput 6y agoOn top of what the article recommends her is my personal pet peeve. STOP using gazillions of nested DIVs only to achieve a single button. I know this is the result of frameworks but maybe, just maybe, somebody someday will start making a clean layout framework that uses TABLE instead of DIV. It's sooooo f*ing much faster.
- maccard 6y agoHave you got any numbers to back that up?
- unnouinceput 6y ago"have you got any..." -duude! just open facebook messenger and inspect any element there, then comeback and tell me if you can't see the gazzilion DIV's there. Or are you referring to table vs. div from performance point of view? For that you can do your own testing. Create a DB, put in there 100k rows and then view them via a framework that uses the gazzilions I mentioned vs a table with 100k TR's. See for yourself which one loads faster. And to get out the loading times from DB, do it once then save it as HTML offline page for both tests and then use those pure HTML to load from local file. See that TABLE is faster.
- cblconfederate 6y agoI thought they did that on purpose, to evade scrapers and ad blockers.
- maccard 6y ago(sorry should have been clear - im talking about the performance of div soup vs a table) I'm aware how to put together those benchmarks, but you're the person making the claim. The onus is on you to prove its faster, not me.
- unnouinceput 6y agoI already proved to myself, exactly like I told you. And since you can do it yourself, then do it. Don't take my word, test yourself. Then comeback and tell me the results of your own benchmark.
- maxharris 6y agoI know this is a difficult thing to raise, but I question the assumption that the technologies underlying web frontends themselves are optimal for energy efficiency. Mobile devices are where power management matters the most, and this is where you find web tech used the least. At the dawn of the present mobile era, there was WebOS, which was built with web tech. The original iPhone unveil showed a phone that only supported web apps, and there was no App Store at all. Android came out of Google, a company that at that point depended completely on web APIs for rendering. Something clearly changed soon after that point, as web technologies were cast aside as the major mobile platforms evolved post-iPhone. Many people ascribe this situation to nefarious motives on Apple's part, and I am aware of their artificial restrictions, including the requirement that other browsers use webkit, the click delay, limited hardware API/camera access, etc. Still, this alone doesn't explain why the other players (especially Google) ended up prioritizing non-web apps. I hasten to add that something is definitely lost in the mobile app store model, namely the freedom of the user and of the content creator to put things on phones without filtering by reviewers. However, I think that issue is orthogonal to the energy efficiency discussion above. And I would be overjoyed to see this resolved in a way that enhances user and creator freedom, without any energy efficiency loss. I have worked with web tech for years, before I quit writing web apps about a year ago. I have spent the last few months learning Swift and Metal, and I can see the relative strengths and weaknesses in both web and native app paradigms. Given the above, I'd like to hear what you have to say: - Did Apple deprecate web apps simply because they couldn't control them, or is there more to it than that, as the above suggests? - Do web technologies have a bright future as a frontend application platform, or will they continue to be eclipsed on mobile devices by Swift and Kotlin, SwiftUI and Flutter? Will this trend continue as VR and AR adoption grows? Why or why not?
- FpUser 6y agoNot a word about the elephant in a room - difference made by underline server technology. Here is the latest example from yours truly: was running a test for a week on my custom http multithreaded stateful server written in C++ that calculates some complex programmable proprietary metrics and serves results as JSON. Beats the system it replaces more than 150 times performance wise sustainable. So that is 150 times less energy per transaction. Not shabby. As to horrors of manual memory management - there are none as there is not a single place where my code explicitly allocates/deallocates memory. Modern C++ is pretty good in this department.
- secondcoming 6y agoWelcome to the good ship 'Modern C++'. You're right too. Most Cloud software is JVM based (Kafka, etc). I would be quite interested to see how more efficient things would be if they were ported to C++. Cassandra is a JVM-based NoSQL DB that has a C++ port called Scylla. Scylla destroys the JVM version.
- fetbaffe 6y agoIt can definitely be true, but it depends what your service does, if you do regular HTML pages what you want is an infrastructure that can do fast string handling, for that I wouldn’t pick C++. And if you need more developer time is also a consumption of energy. I think a more common problem is relying on general frameworks regardless of platform. Frameworks solves a general problem, but you solve a specific problem, as your example shows. How much would it save to use SQL SELECT with the columns you need instead of a ORM that fetches everything? Or what about API endpoints that deliveries everything to single page app that only needs a few values? Most data deliveries online today is never used only to be discarded. And you have that discarding of data at two different places, between the database & the backend and then between the backend and the client. That is probably a higher cost than changing server language.
- FpUser 6y agoYou are making an awful lot of assumptions without having enough info about this particular application.
- nuker 6y agoBan RGB fans
- browserface 6y agoif correctly stated, this is the question the react core team has been dreading.
- donmb 6y agoWhat we always forget in this debate is how much energy the web actually already saved through - for example - more efficient logistics, shorter communication ways etc etc This is something we need to consider in the calculation. And lets say all data centers would work completely "green" - wouldn't this discussion be obsolete?
- elliottinvent 6y agoI think there's so much that can be done with web design to make browsing the web more energy efficient, but in many cases users don't want or need a website – they just want some key data. > "People just want to access content quickly, without distraction, without friction, and without it using a tonne of data." Absolutely, most new websites for small businesses are 90% identical bloated single page scrolling Wordpress sites. When we visit those sites we're often looking for contact info, opening hours, menus, or maybe links to social media so we can interact with the company. So really we want ~100 bytes of data (e.g. address / socials / telephone / opening hours) but we have to download 5mb+ A small team and I have been working on an alternative to the web for structured data. It's a DNS-based protocol that domain / email owners can use to provide data direct to users: https://www.num.uk https://www.num.uk https://news.ycombinator.com/item?id=24354559 https://news.ycombinator.com/item?id=24354559
- austhrow743 6y agoHow do you get around the fact that it's entirely possible to chuck "contact info, opening hours, menus, or maybe links to social media" on a plain text file on a domain right now yet no small businesses are doing it and are instead going with heavy Wordpress sites? If that's what most users want and they want it bad enough to warrant a whole new protocol, then my thinking would be that it would have to provide some sort of competitive advantage. What has prevented it spreading despite this competitive advantage and why is that factor not present when it comes to adoption of your protocol?
- ratww 6y agoI think people just do what they know. Most laypeople that choose Wordpress do so because they want some editing interface. The bloated Wordpress templates are a consequence of them looking good in ThemeForest. There's no incentive for template makers to make super fast 100%-static templates, as those don't attract attention. But given the chance, site owners would replace their sites with whatever works. For instance, and a lot of local businesses where I don't have webpages anymore, but only Facebook profiles with a bunch of photos and text. Some of them even have custom domains that redirect to Facebook! Apple App Clips in iOS 14 is something similar: you don't need an App for scooters or for buying Ice Cream, so I foresee some people moving to those just because it's cheaper to make... and because customers will probably be familiar with them.
- bitwize 6y agoStop cramming everything with fucking JavaScript for starters. If you're running, say, a programming blog, stop sticking Google Analytics, "Like Me On Facebook", and any and all ads. If you've got a hankering to put the information out there, do that, and pretend it's like your old http://your.isp.com/~username http://your.isp.com/~username web page. You don't need to fucking monetize it, it's a blog with your opinion which, like your asshole, is something everybody has one of.
- yholio 6y agoEnergy efficiency is a bad substitute for clean energy. We desperately need vast amounts of clean, emission free energy, to power electric vehicles, trains and tractors, the infrastructure used in their manufacture, the economy as a whole and the quality of life of the other 5 billion who lack internet. The energy that we stand to save on the web, in the best case, is no more that the equivalent of a few points of GDP growth for some impoverished nation. It's less than negligible, it's net negative, because you are wasting the political and human energy optimizing irrelevant things and thinking you've made a difference.
- gmueckl 6y agoNo, internet infrastructure consumes a vast amount of electrical energy. Some put it at 10% of the global use of electricity. That's a lot just to store, process and transfer bits. Curbing that would definitely make a significant impact. Sure, it won't solve the bigger issue in one fell swoop. No single action will. Instead, the way to realistically make progress is via the accumulation of small improvements everywhere.
- kortilla 6y agoNo, that won’t help. Even a 25% gain in all things Internet (which is almost certainly a fantasy) is only 2.5% of global usage in your worst case scenario. That’s outpaced by growth so spending the effort instead on more rapidly rolling out solar/wind and replacing 5% of generation goes much further and can’t be undone by a software update with a new GIF feature that sucks power.
- stuaxo 6y agoThat's a big number and we can do both. Many peoples skills here are more suited to improving internet power usage vs helping roll out wind and solar.
- gmueckl 6y agoSo you'd rather have others contribute 5% than working yourself on getting these other 2.5% that you can do something about? Btw, given the inherent thermodynamic inefficiencies in active datacenter cooling I'd be surprised if we can't do better than 25%.
- macca321 6y agoLobby government for green energy
- gregjor 6y agoUse dark mode.
- cblconfederate 6y agoThis is something that widely used frameworks like bootstrap should take into account. Not only is it energy efficient, it's also snappier for the user and thus time efficient.
- grumple 6y agoI’ve now worked in multiple organizations where I had to fight for years to get staging environments, or to upgrade off long-deprecated software, or to fix vital security vulnerabilities. We bicker with non-designers for hours, days, weeks over whether we need a modal. You think these people will agree to optimize for energy savings? Not a chance, unfortunately.
- mensetmanusman 6y agoGet rid of ads, let people pay for ad-free viewing. Experiment: most media sites are about 1 MB page loads, with iOS ad blockers on, it drops to 1 kB (three orders...)
- john___matrix 6y agoI think it's lovely trying to optimise on what's realistically a small scale (better HTML, some image crushing) but I'd imagine the much bigger issue is the world's never ending creation of pure digital landfill on TikTok, Instagram and Facebook. Encouraging people to record every inane detail of their lives and hosting it must be a massive resource drain somewhere along the line.
- ricardo81 6y agoThink videos are the obvious elephant in the room, more so than JS bloat. One suggestion, use 304 Not Modified when possible, this saves the client re-downloading a document as well as saving any more server side processing that might've been needed to create it. Always wondered why 'popular' JS libraries simply aren't simply bundled in with browsers. Perhaps could be a problem of preferential treatment but I think if the top dozen or so libraries/versions were bundled in then that'd potentially save a lot of bandwidth, latency, CDN usage, etc...
- AQXt 6y agoHere are some Latency numbers every programmer should know (https://gist.github.com/hellerbarde/2843375 https://gist.github.com/hellerbarde/2843375): L1 cache reference ......................... 0.5 ns Branch mispredict ............................ 5 ns L2 cache reference ........................... 7 ns Mutex lock/unlock ........................... 25 ns Main memory reference ...................... 100 ns Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs SSD random read ........................ 150,000 ns = 150 µs Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs Round trip within same datacenter ...... 500,000 ns = 0.5 ms Read 1 MB sequentially from SSD* ..... 1,000,000 ns = 1 ms Disk seek ........................... 10,000,000 ns = 10 ms Read 1 MB sequentially from disk .... 20,000,000 ns = 20 ms Send packet CA->Netherlands->CA .... 150,000,000 ns = 150 ms Most of your code optimizations will pale in comparison to a single disk operation. So, maybe, you should buy more RAM? :)
- filleduchaos 6y agoThis feels rather disjointed from the point of the article, somehow.
- acd 6y agoArchitect/programmer here: Here is a list of how to be more resource efficient / cost effective: 1. Render dynamic assets to static html and cache them via a Content delivery network CDN. This will take far less cpu resources than rendering dynamic content and it will be faster to serve to the users. 2. Set reasonably long cache expire headers for content so that content are cached locally in the browser. 3. Use fast data structures such as hash-tables, tree structures that provides O(1), O(log n) lookup of your data whenever possible. 4. Use fast programming languages and frameworks such as Go-lang, C++, Rust, Scala and Java instead of slower languages. Fast programming languages uses less resources than slow programming languages. 5. This is one controversial since its not the current trend, but consider when to use Mini services / Monoliths instead of Micro services. A Monolith is a single process on one or more host it has access to local CPU cache and memory which is very fast. Mini services/Monolith will be more compute resource efficient than a Micro service where the service call has to be JSON serialized and travel over the network and then deserialized. List of efficient web frameworks: https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=query https://www.techempower.com/benchmarks/#section=data-r19&hw=... List of search efficient data structures. Big Tech companies ask job interview questions on these data structures for reason of speed. https://en.wikipedia.org/wiki/Search_data_structure https://en.wikipedia.org/wiki/Search_data_structure
- deleted 6y ago[deleted]
- ricksharp 6y agoSaving yourself time and money is often more energy efficient. Here is a small example: For my blog site, I use Netlify to host - which auto deploys on a git push. My builds running on Netlify were averaging around 3 mins (every time I pushed whether it updated content or not). I noticed the problem when I almost ran out of build time. So I changed it to build locally and now commit the build output inside my git repo. Netlify deploys in around 5 secs now since it is all pre-built static files - I’ll never run out of build time now. My machine already has all the dependencies and cached build output, so it can build in about 20 secs. In addition, I can handle build errors immediately rather than finding a failed deployment.
- cblconfederate 6y agoUp until recently HN has been heavily upvoting anything from the bloat-as-a-service camp. What happened ?
- alcover 6y agoIn a future with high energy price, I often think all current unoptimized content will get unsustainable and either disappear or make users pay for access. Then optimized free-access content will rule.
- ihadtosayit 6y agoFire the JS hipsters that spend way too many CPU cycles reinventing the wheel?
- dredmorbius 6y agoIncrease the cost of energy.
- akuji1993 6y ago> “But Carl, some of us don’t have the luxury of building super high-performance, lightweight, and optimised sites due to client budgets and deadlines.” Well, I think you need to work on your craft, change your attitude and your priorities, or find another profession. Well, I think my employer doesn't care much about this topic, so I feel like you're talking very condescending to me, while I have little to no control over issues like this.
- C1sc0cat 6y agoYou need to start trying to change your employers/clients mind on this - show them what the cost is by having 5MB uncompressed images and massive blocking JavaScript. "look you having to pay $xxxxxxx in PPC" because that low cost design agency messed up a site redesign.
- dangerface 6y ago> You need to start trying to change your employers/clients mind on this Then don't they needs a new job? Thats not part of a developers job description.
- C1sc0cat 6y agoIs not a developers job description building the site or fixing the damm problem your given? To give an example from my fist job about two years in one morning my boss came in and dumped on my desk some exotic kit from Feranti that cost 2x my salary with the instructions 1 hook it up to the PDP 11 make it work 2 talk to Brian and write the code so he can use it on his 3d capture experiment. My response was "cool"
- laterrasse 6y agoThe European Union introduced a graded energy label for household appliances. How about promoting something similar for websites?
- jiggawatts 6y agoPress F12. No, seriously, do it now. Open your site with the "Network" tab open. Make half of the lines go away. I guarantee you that you can, often with trivial changes to your code. Now do that again. That's going to be harder, but you're on a roll now, you can do it. There you go. Done. You did it. Not really that hard, was it?
- pluc 6y agoGet rid of all the ads and libraries
- draaglom 6y agoDomestic computer use simply isn't a big fraction of a person's total energy consumption: e.g. this study[1] in the UK puts "IT" as <6% of household electricity use, which is itself a fraction of a person's total energy use. edit: and this[2] indicates that datacenter usage is also not very significant. Therefore, no amount of optimising web pages will make a meaningful difference to carbon output. As web professionals, it's better if we direct our focus towards more productive areas around this goal -- by e.g. donating to relevant campaign groups, or using our tech skills to produce media on the topic. [1]: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/208097/10043_R66141HouseholdElectricitySurveyFinalReportissue4.pdf https://assets.publishing.service.gov.uk/government/uploads/... [2]: https://www.iea.org/reports/data-centres-and-data-transmission-networks https://www.iea.org/reports/data-centres-and-data-transmissi...
- crazygringo 6y agoExactly. This is a perfect example of missing the forest for the trees. All of us only have a finite amount of time/attention we can spend on things like the environment. It we truly care, then it's our obligation to spend that time on the changes that have the biggest impact. Let's discuss energy usage of the web once it makes its way into the top 100 areas of potential impactful improvement. Until then, let's put our effort into pressuring our politicians into enacting meaningful change where it matters.
- menybuvico 6y agoThe one thing that could be done is to keep bloat to a minimum. It makes the web faster and less energy use is merely a bonus.
- draaglom 6y agoSee also: Bret Victor's excellent "What can a technologist do about Climate Change": http://worrydream.com/ClimateChange/ http://worrydream.com/ClimateChange/
- throwaway894345 6y agoI don’t doubt the conclusion, but does the 6% figure account for the energy cost at the data center and network nodes, or is it just the power for the user’s devices? (I’m a bit too lazy to skim through that 600 page PDF)
- kindly_fo 6y agoBring back metro style?
- ddevault 6y agoQuit using so much fucking JavaScript, it's as easy as that.
- sys_64738 6y agoWrite static pages in pure html with zero JavaScript.
- ri0t 6y agoI cofounded the Hackerfleet[1] Community, a (rather too small, join! :) group of sailing hackers and nerds. Since we operate our tech stacks with batteries and often only solar/wind power, we try to come up with very energy conservative solutions. One thing we couldn't do without: ARM CPUs even for servers, because they're quite energy efficient. If you have any questions, i'll be checking this comment thread for a few days. [1]: https://hackerfleet.eu https://hackerfleet.eu
- dangerface 6y agoI have lots of questions but none on topic you got an irc or something?
- ri0t 6y agoSure, #hackerfleet on freenode :)
- agentultra 6y agoYou can always reduce consumption. The plastic problem would not exist if we stopped using plastic. That doesn't seem tractable though so we'll probably find ways to enable us to continue consuming more plastic... but we can still try to consume less of the stuff. Same with energy. You don't _need_ your house to be "always on," etc. Turn out the light when you leave the room. Etc. We could similarly not expect the sites to be "always on," and "instantly available," ready to deliver the highest-fidelity content as quickly as possible. Yes, that keeps people engaged. But maybe we don't need more engagement. Maybe we have enough engagement going around. https://hackaday.com/2018/10/08/perfecting-the-solar-powered-web-server/ https://hackaday.com/2018/10/08/perfecting-the-solar-powered... Low-powered, on-demand, peer-to-peer, edge computing seems like a neat idea. I'm not an economist though... I'm not really sure that websites contribute significantly to energy consumption.
- ilikehurdles 6y agoCreate a cryptocurrency that is awarded based on how little energy your computer expends mining it. I know, it probably wouldn't really work or have any effect, but it might be a fun little humorous side project.
- austincheney 6y agoThe biggest thing web developers can do to be more efficient is stop the warfare against their users: * Block all third party script requests * Never access the DOM via a selector (500x slower in Chrome and 20000x slower in Firefox) * Stop relying on 1gb of code from NPM to do your job for you
- ericmcer 6y agoA new project manager was asking me to implement a modal that opened an additional modal on top of it. I lightly trolled him by asking if we were worried about the power consumption of opening multiple modals at once.
- marsdepinski 6y agoLearn to program server side in html and stop using JavaScript.
- zelon88 6y agoI believe the best way to improve the energy efficiency of the web is to improve honey potting. Bots and crawlers use way more bandwidth than actual users. Or you could just route the entire Eastern Block and Russia off of Tier 1. That would literally solve the bot problem overnight and would drastically improve global operational security.
- tanilama 6y agoThe first and foremost question before even bringing up the solutions is: how do you measure? Does web loading time alone reduce the energy consumption?
- foxtrottbravo 6y agoOne idea I may find interesting enough to pursue is finding a solution that delivers an energy optimised experience for different display technologies: - on ips displays, reduce dark greys in davor of black - optimise Energy optimisations for different flavours of lcd But I think there isn’t any straight forward browser API for that
- gorgoiler 6y agoIt feels like the major environmental cost is in the manufacture of new devices. If software were properly optimized, I wouldn’t need to upgrade my machinery. We’d need one fewer open cast mines to dig out rare earth metals. Less shipping. More recycling. (Related, but tangential to web dev: device repair.) I have no idea what I’m talking about though. I come to this site to find people who do.
- Don_Patrick 6y agoI don't imagine that minor code optimisations would make as much difference as shortening the time the user spends on their device. The goal would then be to make websites as concise as possible, toss out all ads, comment sections, social media tie-ins, videos, needlessly long-winded articles, anything that slows the visit down, and kick the user out as soon as they have what they were searching for. But capitalism doesn't approve of that.
- makstaks 6y agoI've been digging into the recommendations from Google's website https://web.dev/ https://web.dev/. I think this supports the recommendations in the article. The great thing about being energy efficient is that it means providing a faster experience for users. A side effect is that it contributes to a higher search result page ranking. Lots of wins here.
- quda 6y agoStatic website, no JS, no images, only html.
- justaguy88 6y agoCut the ads out.
- syastrov 6y agoUse an efficient language like Rust. Work on improving performance/memory usage of slower languages, e.g. Python.
- tatersolid 6y agoJust Stop including third-party JS, especially ads and “tag manager” scripts. At $dayjob we are A/B testing self-hosting every script; my suspicion is self-hosted ads will beat revenue from as networks even after paying for salesperson commissions.