Decarbonization: Energy Efficient Coding Approaches for Reducing Global Energy Consumption

cem akpolat
6 min readMay 30, 2022

Decarbonization, a new trend that emerges in the industry to aims at preventing the increase in C02 level in the atmosphere. This goal can be satisfied from many diverse points, and each sector or technological and non-technological ones should have their own individual solutions. Before all these solutions, we need to question what are the sectors that compose the great portion of CO2 production. This question is not asked today, that is sure, nearly every year the reports are published by sector and countries. There are solutions that attempt to drive the world for reducing the CO2 production, however, a dramatic reduction should not be waited. Nevertheless, we ask the same question once again, and try to figure out the main CO2 producers from the latest report, and then attempt at comprehending what can be done as software developers to contribute CO2 reduction.

Global Greenhouse Gas Emissions by Sector

Main Contributors for CO2 Emission & Energy Usage

According to this report, the CO2 relies on the requirement of the energy need. Industry, buildings, transport and Agriculture account for the great majority of this consumption. In order to live a sustainable world, our purpose should minimize these figures.

What are the Energy Consumption Reduction or Clean Energy Production Approaches?

There are indeed two critical approaches to have an effect on the CO2 emission. The first approach could be to employ the renewable energies as much as possible along with the nuclear energy by considering the treat of the nuclear technologies. Some countries invest the renewable energy since years, e.g. Germany plans to provide its whole energy requirement from the renewable energies before 2040. The countries that invest in these technologies can profit in the long term. On the one hand they will not have an energy abundance on other countries, on the other hand CO2 emission growth will weak over time.

Another research activities on the fusion reactor, see ITER which is founded to research the unlimited energy resource, can have a dramatic effect on the world if it realizes. Even these projects have failed many times until today, they will be always available to solve the energy issue of the humanity. The most important point, unlike the existing nuclear technologies, the fusion approach is seen as clean energy resource.

The second approach is to decrease our energy consumption, either by reducing our needs or by optimizing our process in the different fields of our life. From the industry perspective, the mass production is a continuous process, and demands a continuous electricity. The digitalization of industry and many other fields through IoT shows us clearly what components are energy angry. In addition, the intelligent automation technologies reduce the human intervention and human related failures. By doing that, we can identify where the optimization should be mostly required. For example, if some devices consume huge energy in comparison to other devices, researchers or product developers can concentrate on either production processes or devices to create energy efficient products. With the invention of new technological devices, we may solve many problems over time, however, all these approaches may not have a huge effect overall on the energy consumption in the short term. Assuming that new products are available and consumes much less energy than the existing ones, as long as they are not affordable, industries will not be able to integrate them in their systems in a short time. For this reason, a government support is more than a requirement for the future.

The same thing is also valid for the buildings and transports. In the long term, vehicles with batteries would decrease the fuel usage, however, in order to generate electricity if the fuels or coals are used, then the contribution to CO2 reduction could be limited. We may prefer to consume local products and foods as much as possible to prevent the products delivered from other countries, and employ public transports instead of private vehicles. At this point, there are again two sides of the coin, foods or products that are delivered from different countries might account for the great amount of government budget. For this reason, a complete reduction or removal of these deliveries would have also severe effects in the long term. From the technological perspective, an efficient logistic plan that consider the energy usage, i.e. the usage of electric vehicles for short distance or the combination of the multiple vehicles to reduce the energy consumption can be seen as a solution.

As aforementioned, as long as we have energy dependency in different fields and cannot be satisfied by the renewable energies, our optimization will be rather restricted. Either we should change our behaviors and habituates to prevent wasting energy, or we must devise better plans, devices, processes, etc.

How can software developer/architects contribute to the decarbonization?

As a software developer, the same topic, “how can we contribute to the decarbonization” while developing software products, is frequently asked. Energy saving in the software architectures can be seen from many perspectives,e.g. A well-designed and software components including energy efficient algorithms would reduce the overall usage. A cumulative answer to the title question could be the following items, and they can be extended as well.

  • Use the latest version of software products since they are mostly well improved in terms of the performance and resource usage perspective
  • Reduce data transmission over the network and try to find the shortest paths for the data to be transmitted. This is indeed also related to SDN-Software Defined Networks, where SDN controllers can dramatically reduce the energy consumption by adding new flow paths to the switch, and these can be dynamically configured.
  • Process data at local if it is transmission is not necessary. The harmony of the edge- and cloud-computing can lead to the processing of the data at edge, thus reducing the data transmission over the network.
  • Reduce the amount of data to be transmitted through the compression techniques.
  • Refrain to using redundant servers (virtual machines) if not vital, and focus on container technologies thanks to their flexibility and reliability.
  • Designing loosely coupled systems and switching from the monolithic architectures to microservice architecture to reduce the energy consumption overall. This helps also to identify the more energy consuming component, and even it can be designed in a way that it can consume less energy by using another programming language.

Do programming languages affect the energy consumption?

Apart from the aforementioned perspectives, two are also researches that concentrates on the energy consumption of the programming languages in [1], [2] and [3]. The first one is an elaborated version of the second paper.

In this article [1], based on the conducted experiments, the following graph is achieved, which indicates the energy consumption of each programming language for the same tests.

According to these results in [1] and [3], C and C++ are the most energy efficient programming languages, whereas interpreted programming languages deliver the worst performances. If we depict C and Perl through the European energy standards indicators, the two pictures would not be wrong.

In addition to these results, some critical questions are answered in [1] to figure out whether the programming languages can be energy conservative at each scenario. First important question, whether the faster languages are always the most energy efficient ones? The results depict that this is not always true, i.e. for regex operations interpreted languages are more energy efficient. Even in many test cases they are more performant, the special operations or the results at some fields can be different. The second question is “How does memory usage relate to energy consumption?”. Based on the experiments, the relationship between memory usage and energy consumption is not enough evident, however, this relies on the test methods. Even though the authors cannot find a clear evidence, they claim there can be a clear difference between programming languages with respect to their memory usage approaches.

The last question is whether we can automatically decide what is the best programming language considering energy, time and memory usage? Actually, the results show that in case execution time and energy consumption are considered, then it is possible to select the best energy efficient language. Whenever the memory usage is involved, it is not possible to have a correct selection. For this reason, the recommended approach by this work, if developers would decide on a programming language, they should consider what functional and non-functional characteristics are significant for their scenario,

References

1- Energy Efficiency across Programming Languages, https://dl.acm.org/doi/10.1145/3136014.3136031

2- Towards a Green Ranking for Programming Languages, https://dl.acm.org/doi/10.1145/3125374.3125382

3- Analyzing Programming Languages’ Energy Consumption: An Empirical Study, https://dl.acm.org/doi/10.1145/3139367.3139418

--

--