[HN Gopher] Reduce your website's environmental impact with a ca...
___________________________________________________________________
Reduce your website's environmental impact with a carbon budget
Author : stareatgoats
Score : 41 points
Date : 2021-12-08 18:28 UTC (4 hours ago)
(HTM) web link (css-tricks.com)
(TXT) w3m dump (css-tricks.com)
| pavlo wrote:
| The article criticises large sites saying that "[t]he average web
| page size now stands at around 2MB." but the page where the text
| is published is 1,5 MB itself. Its a bit sad, but probably makes
| the point precisely.
| dest wrote:
| Including a stellar 378kB PNG image of 2776*1381 pixels, while
| it's only a small illustration in the article.
|
| https://css-tricks.com/wp-content/uploads/2021/11/cloud.png
| Lukas_Skywalker wrote:
| Wow. A quick and dirty vectorization yields an SVG of 9kB.
| The PNG even looks like it was originally an SVG with some
| linear gradients.
| _fat_santa wrote:
| The COP26 site is a bad look.
| open-source-ux wrote:
| What about calculating the environmental impact of the
| programming language you use?
|
| Some of the most popular languages are the least performative (we
| all know which ones). But they make life easier for developers,
| or as programmers love to say 'more productive'.
|
| It's good to see new(ish) languages take performance seriously:
| Rust, Go, Nim, Crystal, Julia. I don't think it's controversial
| to say a typed, compiled language gives you good performance for
| free (and the reduced computing resources that implies).
|
| When PHP 7 was released, Rasmus Lerdorf, the creator of PHP, said
| the performance improvements meant fewer servers, smaller memory
| use and reduced CPU activity - all of which equalled less power
| or electricity consumed. (And remember this is an interpreted
| language.) You can watch a segment from his presentation below
| where he talks about this, including the calculations he made of
| potential CO2 savings:
|
| _Rasmus Lerdorf - "PHP in 2018" (extract from the 15 min mark)_:
| https://youtu.be/umxGUWYmiSw?t=15m16s
|
| When you consider the millions of servers in use, that additional
| language efficiency adds up to a substantial saving in
| electricity use. And yet among developers, a common response to
| performance issues is to say: hardware is cheap, just add another
| energy-guzzling server or use a more powerful computer.
|
| The topic of ranking programming languages by energy efficiency
| has been discussed before on Hacker News. Here is the paper
| previously discussed which has been updated in 2021:
|
| _Energy Efficiency across Programming Languages_ :
| https://sites.google.com/view/energy-efficiency-languages
| kitsunesoba wrote:
| Very happy to see someone talking about this. I've thought for
| several years now that it was odd how environmental impact tends
| to get swept under the rug in the fervor of trends in web dev
| frameworks and tools.
| jefflombardjr wrote:
| I'm sure this is really well intended, but the individualization
| of environmental guilt is a major problem. [0]
|
| Where I agree with the article is to use tools like lighthouse
| and write code that uses the language properly. It is absolutely
| individual's responsibility to do this. The responsibility of
| making code efficient (dare I say "green") lies in those writing
| the browser engines/compilers.
|
| 0: https://medium.com/@mitpress/individualization-plant-a-
| tree-...
| zebraflask wrote:
| Not 100% on topic, but related - not mining or using crypto or
| writing apps / software / sites that enable it, at least the
| ones like Bitcoin that are massively greedy re: electrical
| usage, might also be effective.
| maelito wrote:
| Individualisation is just a step needed for collective change.
|
| From the individual to the state and then the world, everything
| is continuously collective.
|
| You just can't hope your institutions to change if a minority
| of citizen haven't proven lowering one's environmental impacts
| is possible, and made it socially desirable.
|
| Then institutional change can happen.
|
| In democraties at least, comsumer-citizens are necessary for
| the system to change.
| jefflombardjr wrote:
| Totally. But not in software.
|
| Take a look at Code Complete: Chapter 25. Does a way better
| job explaining this than I could in a comment box.
| wmf wrote:
| In the developed world we've already gone beyond the optimal
| point of individual environmental responsibility and it's all
| diminishing returns from here.
| gruez wrote:
| >The responsibility of making code efficient (dare I say
| "green") lies in those writing the browser engines/compilers.
|
| I don't get it. Are they not doing that? Performance and
| battery life is a major selling point for browsers. If anything
| the biggest failure is at the individual developer/site level,
| not that firefox causes your fan to spin into overdrive when it
| tries to load a SPA monstrosity.
| jefflombardjr wrote:
| They are 100% doing it. A lot of really bright people work on
| the engines/compilers.
|
| The problem is telling individuals to focus on optimization.
|
| Let's use javascript as an example. Say you need to transform
| an array. You can use `.map` or a `for` loop in javascript.
|
| You see a lot of articles like this
| https://dev.to/henryjw/array-map-much-slower-than-for-
| loop-5... that say a `for` loop is faster. And sometimes it's
| true.
|
| By the logic of the original article, you should
| hyperoptimize your code. The problem is. If everyone writes
| `for` loops instead of using `map`. When map eventually
| becomes more efficient there's all that garbage code out
| there that has to be refactored.
|
| Ignoring the problems associated with benchmarking - this for
| example claims map now being faster than for loops.
| https://leanylabs.com/blog/js-forEach-map-reduce-vs-for-
| for_...
|
| It comes down to return on effort. We only have so much
| effort to put at solving this problem. You maximize your
| return on effort by having a clear separation of
| responsibility. In this case the individual's responsibility
| is to write code to the latest spec. The institution's
| responsibility is to make the code written as efficient as
| possible.
|
| A single website saving .000000001 ppm of carbon
| (exaggerating) is just never going to be worth the effort.
| But a compiler improvement on all websites running
| javascript. Now that's totally worth it.
|
| Further reading behind this logic:
| https://www.goodreads.com/book/show/3828902-thinking-in-
| syst...
|
| https://stackify.com/premature-optimization-evil/
|
| Code Complete (chapter 25.2)
| https://www.oreilly.com/library/view/code-complete-
| second/07...
| jefflombardjr wrote:
| P.S. Thoughts: This might be the case for software
| engineering, but might break down in other domains and
| should be applied carefully elsewhere.
|
| For example recycling plastic is your responsibility - but
| what if your city burns plastic recycling? What do you do?
| Do you continue to buy plastic blame the companies for
| using it and the city for burning it? Why should the
| individual be penalized?
|
| This seems more gray to me, like yeah okay I'm going to
| reduce the amount of plastic I buy in that case. And there
| are alternative like paper. In programming it feels more
| black and white. There is map and it serves a single
| purpose.
| kitsunesoba wrote:
| Google and Mozilla seem considerably less concerned about
| efficiency than Apple and Microsoft are. Safari is well known
| for being easier on the battery than Chrome and Firefox are
| on macOS, and pre-Chromium Edge had similar efficiency
| margins over Chrome and Firefox on Windows. I've heard that
| even Chromium-Edge tends to outperform its competitors on
| Windows even now.
|
| This starts to make sense when you consider that for Apple
| and Microsoft, end users are the customer and bad battery
| life is going to have implications on number of devices sold.
| For Chrome and a lesser extent Firefox, the "customer" is
| instead web devs, who are more interested in a constant
| stream of new features than they are efficiency.
|
| That said, both browser vendors and site devs are
| responsible. It doesn't matter how optimized the browser is
| if a site loads tens of megabytes of dependencies and is
| written with expediency and cheapness in mind only.
| amelius wrote:
| Another solution I hear often is to simply tax the power used.
| sudopluto wrote:
| no, it is not not only the responsibility of those writing
| browser engines / compilers.
|
| it is the fault of the product designers who take any
| advancement in the efficiency of technology as a excuse to push
| more crap. see: blockchain for the sake of blockchain, machine
| learning for the sake of machine learning, web apps for the
| sake of web apps
| saagarjha wrote:
| No, this is wrong. Performance is _everyone 's_ responsibility,
| because compilers are fundamentally garbage-in-garbage-out. The
| people that work on them are incredibly smart and I don't want
| to discount that, but there is fundamentally nothing they can
| do if you write something nontrivial that's O(n^3): that's on
| you to fix. The fact is that a lot of websites leave timers
| running in the background or use really inefficient ways to
| manipulate the DOM, and despite the work of all major browser
| vendors there's not much that can be done here except asking
| the people that make those websites to not do this. If you're
| one of them, you should make it your responsibility to care
| about performance.
| gherkinnn wrote:
| Isn't this well in the _penny wise, pound foolish_ territory? I
| might as well try to fart less.
|
| And if one _really_ wants to save the planet by reducing page
| foot print, surely killing tracking and ads would be the place to
| start. Or just run an uBlock Origin.
| gruez wrote:
| > Isn't this well in the penny wise, pound foolish territory? I
| might as well try to fart less.
|
| Agree. Carbon emissions from client computing is probably a
| blip in terms other sources. Wasting resources (ie. cash spent
| on developers that could otherwise be allocated elsewhere) is
| counterproductive to the goal of reducing emissions as fast as
| possible. That's why I'm much more in favor of a carbon tax
| than random propositions that attract attention but have
| questionable efficacy (see also: plastic straw bans).
| kitsunesoba wrote:
| That strongly depends on where the saved developer resources
| (which I think are frequently overstated, but that's another
| topic) are allocated. If they're put towards squeezing more
| ad dollars for example, that's still a net loss
| environmentally.
| aranchelk wrote:
| You can estimate a direct environmental impact of the Internet
| and then try to tie it back to individual websites, but it pains
| me that these articles seem to ignore the externalities,
| specifically how much more efficient many industries are
| specifically because of the Internet. E.g. commercial flights (at
| least pre-Covid) are generally full now and as a consequence much
| more efficient because of tech starting with travel sites like
| Hotwire.
|
| So many of our business ideas are about reducing financial waste
| and often times that absolutely has an environmental component.
| If I've got a web app that's reducing waste of some external
| resource (fuel, food, etc.), the positive external impact may be
| orders of magnitude more, and spending the effort to rewrite it
| in vanilla JS versus improving quality and fixing bugs may be
| time very poorly spent.
| paisawalla wrote:
| The cost-benefit analysis has been replaced by univariate
| zeroism in our society.
|
| > _No one is too small to make a difference._
|
| And apparently no difference is too small to pursue.
| cogman10 wrote:
| The "all or nothing" attitude is something that drives me
| nuts.
|
| Climate change is real, for sure, but we don't need to book-
| keep every single source of CO2 emission.
|
| Data centers are a blip when it comes to CO2 emissions.
| That's why companies like microsoft and google can earn good
| citizen points by purchasing offsets. It doesn't cost a lot
| of money to offset because they aren't emitting a lot of CO2
| in the grand scheme of things.
|
| Amazon's logistics emit WAY more CO2 than AWS does. It's not
| even close.
| paisawalla wrote:
| You see it everywhere: in climate change, our societal
| response to COVID, in claims of inequity that basically
| equate any statistical variation with -isms and -phobias. I
| personally believe that education inflation is at play:
| nominally, rates of people who have university degrees are
| up, but the real value of education has been replaced by
| inferior methods and poor-quality thinking. In particular,
| a false confidence in their understanding of statistical
| data.
|
| So you have a lot of people walking around with the
| confidence of having earned a degree and completed an
| education, when they actually just have brain worms. And
| they're impervious to criticism to the point of arrogance,
| because they're College Educated.
|
| I think the solution (or at least, something you personally
| could help do to change things) will be found in hiring
| practices. For open positions in fields not requiring
| specific specialized skills like the law, STEM, etc: stop
| requiring college degrees, and start using IQ tests or
| similar filters for those roles.
| kitsunesoba wrote:
| I think the argument is less for rebuilding existing sites, and
| more for paying some mind to efficiency when a site is first
| being developed and during rewrites brought on for other
| reasons. A good deal of waste reduction is possible with
| relatively little effort if it's done at the right time.
| aranchelk wrote:
| The argument you are making is especially strong for people
| writing stuff like frameworks, build tools, etc. where a
| change could potentially impact all the developer users and
| in turn their end users.
| worldofmatthew wrote:
| https://www.websitecarbon.com/website/worldofmatthew-com/ -
| "Hurrah! This web page is cleaner than 95 % of web pages tested".
|
| I don't think my website will be causing too many problems with
| the planet. Next I will be using mainly AVIF images for article
| images. Moreeeeee optimizations.
| thelopa wrote:
| It said my personal site was cleaner than 100% of web pages
| tested. It said that loading my page costs 0.00g of CO2. Not
| bad!
| nickdothutton wrote:
| The carbon calculator produces the same result whether a site is
| served from a 1400w server or a 5w Raspberry Pi. Into the trash
| it goes.
| choward wrote:
| I found the lack of mentioning ad and tracking scripts to be
| noteworthy.
| mro_name wrote:
| nice hints, thanks for posting! And indeed Greta is right.
| realreality wrote:
| The greenest site is the one that never gets built in the first
| place.
|
| We need to be honest about how much energy is being spent on
| unnecessary activity.
| badhombres wrote:
| I'm curious on what the percentage of contribution from the
| different aspects of loading a website are. How much are from the
| data center, from the network transfer, from the computer loading
| the website, etc.
|
| If the data centers could run on cleaner energy, how much does
| that contribute to the CO2e measurements?
___________________________________________________________________
(page generated 2021-12-08 23:02 UTC)