
How can we, as web professionals, help to make the web more energy efficient? - giuliomagnifico
https://cmhb.de/web-design-and-carbon-impact
======
draaglom
Domestic 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/...](https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/208097/10043_R66141HouseholdElectricitySurveyFinalReportissue4.pdf)

[2]: [https://www.iea.org/reports/data-centres-and-data-
transmissi...](https://www.iea.org/reports/data-centres-and-data-transmission-
networks)

~~~
LeifCarrotson
Exactly.

If I hypothetically ran an inefficient 500W dedicated server 24/7 for one 8760
hour year, and my electric utility produces 1 lbs of CO2 per kwh, that's about
2 tons of CO2 due to my programming habits per year.

Last year, I had a long commute and an inefficient vehicle. 1 gallon of gas
produces 20 lbs of CO2, I got about 18 mpg, and drove 25,000 miles, mostly due
to commuting, so my driving added 12.5 tons of CO2 to the atmosphere.

Instead of making my computing more efficient, I changed jobs and vehicles.
Now I drive 2.5 miles to work, at 30 mpg, fill up maybe once a month instead
of twice a week, and am much happier for it! If I spent extra time to do more
efficient programming, I could have decimated my server's power bill, and
could have saved almost 1.9 tons of CO2, but by spending that time looking for
a better job and better commute, which were far more extreme, I saved about 10
tons of CO2 instead.

~~~
chrisballinger
If you’re concerned about your carbon footprint and live within 2.5 miles of
work, you might want to consider a bicycle instead! Regular cycling has made a
profoundly positive impact to my life, and I would highly encourage you to
explore that as an option.

~~~
gonzo41
I think you're right. I've been thinking for a while that the real future in
electric vehicles is not Teslas or any EV to replace a car but Ebikes. Cheap,
great range and you're getting some exercise and for every person on a bike.
Other traffic flows better.

------
aaccount
Stop 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.

~~~
411111111111111
> _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._

Citation needed. Running your site in a container on a shared host will be
significantly more energy efficient then running hardware. It's silly to claim
otherwise.

And the idea that the quantity of js libraries before compile affects energy
consumption is a stretch as well.

The issue is how many computations you do at runtime. That is completely
unrelated to third party libraries.

~~~
bildung
I think the main problem is that most computation happens at the user's
browser - the different types of hosting will barely play a role in the
overall footprint of a website.

Edit: For an example, look at the app store for the oculus quest:
[https://www.oculus.com/experiences/quest/](https://www.oculus.com/experiences/quest/)
\- That site is ridiculously slow for what it actually does: Static text +
images. And the current state already is way better than before! Almost all
content is either static (the apps) or cachable (the ratings). There are
barely 100 apps in the store, so this isn't exactly a case where there have to
be hot updates every few seconds. This should be rendered server-side, cached,
and then sent to the users as static html. The world could save literally tons
of CO2 with proper design here.

------
yholio
Energy 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
No, 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
No, 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.

~~~
gmueckl
So 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%.

~~~
Arcuru
The total overhead, including cooling, is only ~10% for Google datacenters
[0], and the other cloud providers are likely similar. Efficiency gains of
that scale probably need to come from somewhere else.

[0]
[https://www.google.com/about/datacenters/efficiency](https://www.google.com/about/datacenters/efficiency)

------
eplanit
Stop including megabytes of javascript in every page, and composing pages from
100s of requests to microservices. In short, keep things simple.

~~~
zaro
But what should we do when things are actually complex?

There is a lot of negativity here on HN on the same things you mentioned, but
I fail to see any viable alternatives.

Like what? Replace the MB of JS with plain Html and forms? It's not going to
be simpler to code, and it's definitely not going to be simpler for the users.
Or maybe use a native desktop app? Then it's even more complicated for the
users, and coding it leads you in world of cross platform pain. And the
closest thing there was to not using MB of Javascript and have decent UX was
Java and applets/jlnp, but it somehow didn't manage to be widely adopted.

~~~
blackflame7000
Shot in the dark here, but perhaps you could try leaving the functionality the
same and just try taking out all that code that tracks every pixel the user
looks at, for how long, and how they can better market porn to that
user...seems like that stuff could be taken out...

~~~
larzang
What programmer wants to add those things? Ads have been the bane of the
internet for 20 years, how many times has a developer excitedly clamored to
ruin their performance metrics, layout, security, etc with more ads? How often
are programmers arguing for incredibly complex UI elements over the native
(and trivial to implement) alternatives?

Programmers don't choose these things, because programmers aren't the real
decision makers, it's management and business that makes the web awful.

~~~
manicdee
> What programmer wants to add those things?

The one that wants to keep their job.

> How often are programmers arguing for incredibly complex UI elements over
> the native (and trivial to implement) alternatives?

The existence of Bootstrap and Semantic UI suggest that programmers are in
fact often arguing for incredibly complex UI elements over the native
alternatives.

------
ogou
I 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.

~~~
bill_mon
You're right, but that doesn't mean we shouldn't do anything. If we can flip a
bit somewhere to save some minute amount of energy, we should do that. For
example: optimize PNGs, it's easy and a one time procedure.

We can't change what's in the chair but we can change our product.

~~~
scrollaway
If the effect is minute enough, you might be using more net energy thinking
about this, typing this comment, discussing it with others and optimizing your
final png than actual energy saved for your users.

Feel-good savings are not helpful. You can do it but let's not pretend.
Reminds me of an ex girlfriend that would account for coins she found on the
ground in her monthly budget...

~~~
searchableguy
> Reminds me of an ex girlfriend that would account for coins she found on the
> ground in her monthly budget...

Where do you find enough coins on the ground for that? I haven't come across
any in my entire life.

~~~
scrollaway
You don't, that was kinda my point :) she'd find maybe 1 eur a month if lucky.

------
akuji1993
> “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
You 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
> 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
Is 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"

------
DoingIsLearning
One 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?

~~~
jakecopp
I 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!

~~~
anon9001
Does that actually work?

I would think the invisible hand of the market would re-route all that
pollution to areas without the tax and the earth wouldn't see that much
difference. It's not like they're going to stop selling oil if the EU and US
agree to stop burning so much of it.

I agree it's complex, but I think carbon taxes might be part of the
complexity. If we're going to start messing about with markets, we should
outright ban the offending activity and regulate harshly. If we're going to
apply tokenomics to the problem and pretend we fixed it until we're too old to
care, that seems worse somehow.

Or we can just do nothing and hope technology saves us. That's what the actual
bet is whether we like it or not.

~~~
mac01021
There are very reasonable legislative proposals for a carbon tax (most
preferably a "fee-and-dividend" [1]) which apply border adjustments to
imported goods based on their carbon footprint.

This prevents the tax from simply causing the production of the goods to move
overseas, and also encourages your country's trade partners to adopt a carbon
tax themselves (so they'll be exempt from the carbon tariff).

Such a policy is not attempting to distort the market so much as simply price
in an externality that is currently causing the market to perform poorly. It
says simply that, while I am still allowed to hop on a 3000-mile flight to
visit San Fransisco for the weekend, I need to compensate you and your family
(and everyone else in the country) for the associated damages.

On the other hand, because human civilization is so complex, outright bans and
strict regulations on emissive activity are inevitably going to be ham-handed
and will either be ineffectual or else too onerous to be politically viable in
a democracy.

[1] [https://energyinnovationact.org/](https://energyinnovationact.org/)

~~~
edflsafoiewq
> apply border adjustments to imported goods based on their carbon footprint

The original question _was_ how to find out the carbon footprint of goods.

~~~
mac01021
That is true. But finding out those numbers is a much bigger problem for you
or I than it is for a national government that can dedicate full-time research
staff to producing sensible estimates.

So a benefit of this policy is that environmentally conscious private citizens
no longer need to feebly grapple with such questions. You and I just optimize
for personal expense and our own happiness while computing the carbon
footprints of various things is the responsibility of institutions that
actually have the resources to do it.

------
higerordermap
Lot 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
You 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.

------
elliottinvent
I 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
How 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
I 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.

~~~
elliottinvent
Yes I agree. I think small businesses go down that route because it's what
everyone else does. I think the majority of small businesses don't choose
Wordpress, the web designer does.

I don't think most companies need a website, Facebook offers great tools to
engage with customers but as a website it basically just lists key data. So
all they really need a website for is to provide customers with key data.

------
acd
Architect/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=...](https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=query)

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)

------
Trowter
[https://motherfuckingwebsite.com/](https://motherfuckingwebsite.com/)

~~~
Shared404
A series of websites everyone should read at least once.

------
FpUser
Not 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.

~~~
fetbaffe
It 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
You are making an awful lot of assumptions without having enough info about
this particular application.

~~~
fetbaffe
No, I didn't.

Quote myself "but you solve a specific problem, as your example shows."

So I have to assume your choice of technology for your problem was the correct
one & the stats you supply seems to backup such claim.

However you also implying a bigger claim that C++, or something similar, is
preferable in web development, where you mostly do string handling, is not
something I can agree with.

~~~
FpUser
>"However you also implying a bigger claim that C++, or something similar, is
preferable in web development, where you mostly do string handling, is not
something I can agree with."

I was contracting with a decent size org a while ago and they had tons of web
applications, some of them very giant. The total size of their code is insane
and it is all PHP and Python on a server size. I was personally dealing with
their application that had more than 5000 source code files. There was a lot
of logic in there I would say, not just ReadString / TransformString /
WriteString. That particular application would've definitely benefited from
faster language.

I understand that in many cases most of the heavy lifting is done with the
libs created in C/CPP and the rest is just a thin glue but I do not really
know the real world stats on a subject.

So you can be right or not or the truth is somewhere in a middle.

------
dehrmann
I'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
Just, 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.)

------
AQXt
Here 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
This feels rather disjointed from the point of the article, somehow.

------
unnouinceput
On 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
Have you got any numbers to back that up?

~~~
unnouinceput
"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.

~~~
maccard
(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
I 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.

~~~
maccard
> I already proved to myself, exactly like I told you.

No, you didn't. You made a claim, and then stated it was true based on your
description, not based on the results.

> Then comeback and tell me the results of your own benchmark.

You're the person who is claiming it's faster. As I said above, The onus is on
you to prove its faster, not me.

------
nicbou
Working 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.

------
kstenerud
My 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
Someone cue in the appropriate xkcd about n+1 standards.

~~~
kstenerud
Someone cue in the tired old discussion pointing out that the standards xkcd
comic was about the futility of all-encompassing standards, not an
admonishment against making something better.

------
maxharris
I 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?

------
fxtentacle
Quite 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?

~~~
pantulis
Yes, 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.

------
bitwize
Stop 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.

------
ri0t
I 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
I have lots of questions but none on topic you got an irc or something?

~~~
ri0t
Sure, #hackerfleet on freenode :)

------
tannhaeuser
"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.

------
agentultra
You 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...](https://hackaday.com/2018/10/08/perfecting-the-solar-powered-web-
server/)

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.

------
dehrmann
Not the web, but abandon Bitcoin.

~~~
josalhor
I 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/S22146...](https://www.sciencedirect.com/science/article/abs/pii/S2214629620302966?via%3Dihub)

------
gorgoiler
It 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.

------
dfischer
It'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!

------
4gotunameagain
Retire 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"

------
ricardo81
Think 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...

------
4140tm
I'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.

------
mattlondon
A 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).

------
Pfhreak
Wait, 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
> 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.

~~~
Pfhreak
Yes, 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.

~~~
dehrmann
> Yes, it's absolutely a reason to consider not making something more
> efficient.

Let's assume a smartphone has a battery capacity of 10WH (3000mAH * 3.7v), and
you're charging your phone once per day to make up for aggregate inefficiency.
If retail electric is priced at $0.10 per KWH, that's 36 cents per year? On
the emissions front, that's negligible.

~~~
e2le
Is it worth considering the pollution and financial costs of replacing a
battery? I suspect writing more efficient software would allow batteries to
last longer and manufacturing new lithium batteries is anything but easy on
the environment.

------
grumple
I’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.

------
mro_name
I'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)

------
elihu
> "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.

------
donatj
Cached 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.

------
gao8a
Sometimes I recycle tabs instead of opening a new one :)

------
dgellow
Just 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).

------
austincheney
The 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

------
ricksharp
Saving 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.

------
mbgerring
This 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
Advertising is a cancer that needs to be eradicated; it not only wastes energy
but also human time.

------
marsdepinski
Learn to program server side in html and stop using JavaScript.

------
makstaks
I'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.

------
Izmaki
One goal that covers all suggestions: reduce advertisement.

------
mensetmanusman
Get 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...)

------
LukeB42
Talk more about what regulatory pressures can be applied to help these
companies evolve:

[https://theguardian.com/sustainable-
business/2017/jul/10/100...](https://theguardian.com/sustainable-
business/2017/jul/10/100-fossil-fuel-companies-investors-
responsible-71-global-emissions-cdp-study-climate-change)

------
elliotbnvl
Stopped 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
Same here, that came off as really privileged.

------
tarsinge
In 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.

------
zelon88
I 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.

------
donmb
What 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?

------
foxtrottbravo
One 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

------
cblconfederate
Up until recently HN has been heavily upvoting anything from the bloat-as-a-
service camp. What happened ?

------
tatersolid
Just 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.

------
jiggawatts
Press 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?

------
secondcoming
I 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.

------
eitland
Many 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).

------
ericmcer
A 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.

------
RcouF1uZ4gsC
For the backend, stop using Php, Python, Ruby and start using Java, Rust, or
C++.

------
ilikehurdles
Create 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.

------
alcover
In 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.

------
cblconfederate
This 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.

------
cel1ne
Use 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
This 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...](https://andydavies.me/blog/2018/09/06/safari-caching-and-3rd-
party-resources/)

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)

------
tanilama
The first and foremost question before even bringing up the solutions is: how
do you measure?

Does web loading time alone reduce the energy consumption?

------
laterrasse
The European Union introduced a graded energy label for household appliances.
How about promoting something similar for websites?

------
syastrov
Use an efficient language like Rust. Work on improving performance/memory
usage of slower languages, e.g. Python.

------
dusted
Stop using javascript. Stop using CSS or color. Don't put any images in the
document that are not important to the content.

~~~
mcv
Color is actually relevant. Dark mode can save a lot of energy on OLED
screens.

~~~
dusted
Color 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
I fully support this principle.

------
john___matrix
I 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.

------
matkoniecz
"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
It 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
Very interesting. I would expect it to be much lower. I wonder how much of
this is wasted on cryptocurrencies.

------
ddevault
Quit using so much fucking JavaScript, it's as easy as that.

------
sys_64738
Write static pages in pure html with zero JavaScript.

------
throwaway7281
Less javascript?

------
gregjor
Use dark mode.

------
pluc
Get rid of all the ads and libraries

------
Don_Patrick
I 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.

------
soulchild37
Use less javascript framework lol

------
macca321
Lobby government for green energy

------
browserface
if correctly stated, this is the question the react core team has been
dreading.

------
dredmorbius
Increase the cost of energy.

------
justaguy88
Cut the ads out.

------
nuker
Ban RGB fans

------
RcouF1uZ4gsC
Stop using Python, Ruby, Pho

------
jimbob45
So the solution is more minimalist web design? No thank you. I’m quite over
stripping down websites to their basest functionality.

~~~
jamil7
Theres 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.

------
jillesvangurp
IMHO 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
This 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
It'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.

