Sustainable applications are becoming increasingly important, because more and more energy consumption is attributable to the operations of a platform or application.
On the user side, this can be seen in the battery life of a laptop or cell phone and as a platform operator, it can be seen in the costs of compute power. In this repository I use well-known and daily snippets and compare them to sustainable implementations.
It's worth it!
Code samples and snippets based on .NET
.NET Object Pooling with StringBuilder
.NET Less Allocations with Hyperlinq
.NET Low Allocation Log Message Generation
.NET C# 10 String Interpolation
.NET String ToUpper vs. ToLower
.NET Enumerate List vs. IEnumerable
.NET DateTime vs. DateTimeOffset - UtcNow vs Now
.NET Linq Compiled Expressions
.NET Nullable Value Access (Pattern Matching)
.NET String Create Value Stringbuilder)
.NET List ConvertAll vs Select-ToList
The energy consumption of an application itself is comparatively complex to measure and often inaccurate. Therefore, proxy measurements are mostly used: the better an application performs, the less energy is required.
The combination of the performance of the code and the energy consumption of the hardware then results in the CO2 footprint, for example.