Danny van Kooten develops the WordPress plugin Mailchimp for WordPress - which currently has almost two million active installations. Thanks to lean development, the extension saves an estimated 59,000 kg of CO2 per month. We spoke to Danny about efficient programming and sustainable WordPress.
The internet, WordPress and WordPress hosting consume a lot of energy. How "green" is the leading content management system? And what contribution can we all make to this, whether as developers or in the use of WordPress? Nine questions for Danny about his CO2 emissions on the web initiative.
Sustainable WordPress: be part of it
Danny, efficient WordPress projects help protect the climate. How does the saving work?
To view a website, a series of files must be downloaded to the computer. The browser then processes these files in order to display them on the screen ("render"). The smaller these files are, the less data is transferred over the Internet. This saves energy at all nodes in the network - i.e. between the computer and the server on which the website is hosted.
Sustainable WordPress development
If a website has a lot of visitors, then it pays off enormously to keep it as lean as possible. Because even a minor optimization adds up in this way.
Which optimizations for which languages or formats have the greatest impact?
Providing videos and images with a lower resolution and running less JavaScript is usually the biggest gain. The energy costs incurred when transferring a file on the Internet also depend on which network is used. For example, a fixed internet connection is much more efficient than a wireless mobile connection.
For this reason, the biggest leverage is probably to optimize your website so that images and videos are provided at a lower resolution.
Optimize WordPress plugin
Mailchimp for WordPress saves about 59 tons of CO2 per month. How did you come up with that figure?
Mailchimp for WordPress loads a JavaScript file on every website where the plugin is installed. I reduced the size of this file by 20 KB by replacing a third-party library with some custom lines of code. Because we were actually only using a very specific part of the library.
As the plugin is activated on around two million websites, this saves around 40 GB of data transfer if each website has exactly one visitor. If you now multiply this by an estimated average of 10,000 monthly visitors per website, you arrive at a saving of around 400,000 GB per month.
Assuming 0.5 kWh per GB of data transfer and 295 grams of CO2 per kWh of energy, this means that the reduction of 20 kB saves a total of approx. 0.5 * 0.295 * 400,000 = 59,000 kg of CO2 per month.
I'm making a lot of assumptions here about the number of monthly visitors per website, how well devices cache files and which networks are used. However, my main intention was not to give an exact figure. But to show how efficient it can be to think about CO2 savings in our work too. And not just in other areas of life.
Libraries from third-party providers
How do you manage to incorporate potential savings into your development process?
With my WordPress plugins, I am very careful when retrieving third-party libraries. I do this whenever I'm working on a file that needs to be uploaded to the public area of a website where the plugin is activated. With the advent of NPM and CDN, it has become very easy to build in a dependency.
This is great if you are working on server-side software. But it is less useful if you are working on JavaScript that is to be executed in the browser. I think the following helps:
- A rough idea of how languages work at a lower level
- To know: Which algorithms come into play when using a function of the language in which you are programming?
Both are useful when deciding which tools are right for the job. Learning C is ideal for this. Because C is a language in which you have to take care of many details that other languages take care of or have abstracted.
What tools are available to make the code leaner and more efficient?
There is compressed-size-action for JavaScript and GitHub. This allows you to track the reduction in file size. Every time you make a change to your code base, you can immediately see whether important files have become larger - and whether this change is worthwhile. For complete websites, I recommend Chrome Lighthouse.
To check the sustainability of a WordPress plugin or theme as a user, you can do the following: The easiest way is to run Chrome Lighthouse before activating a theme or plugin. Then run it again as soon as the extension is activated and configured. This way, everyone can decide for themselves whether the function is worth the drop in performance.
"Green" newsletter
My recommendation: Send emails in plain text format whenever possible. These are less likely to end up in the spam folder. What's more, study after study shows that plain text also leads to better conversion rates. And of course, such emails use fewer resources - so it's a win-win situation!
What are the most important levers in everyday online life to save CO2? Even apart from WordPress?
The most important lever is emissions that you impose on others without them having control over them. You can configure your streaming software to load videos at a lower resolution. However, the effect would be far greater if our streaming software did this for us. A website is no different here.
A few words about you and your WordPress plugins?
I've been working with WordPress since before Post Types existed. I released my first plugin just over a decade ago. Since 2013, I've been working with a small remote team and building WordPress plugins full-time. Nowadays, we mainly focus on creating plugins that make websites more efficient. Or that emphasize privacy, like our latest plugin Koko Analytics on WordPress.org.