-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Complied Languages rather than Interpreted Languages #132
Comments
I'll convert this, but I'm torn. This topic is very complex and I think we should touch it very carefully. Maybe the best option is to have a project that does actively benchmark this. The greenlab link seems to provide a GSF compatible source, but the last work done is from many years ago. @dubrie Is there a category for this? I would throw it into cloud, but maybe there could be a more general category |
@markus-ntt-seidl I think cloud is OK as a category for now (can re-sort as more patterns get filed) but we do have a tag for programming-language already so let's make sure that tag is in there. |
We would love shift the focus of the pattern towards what is the most energy efficient solution for a given problem. Most developers would not write a REST API in a low-level language like C (although maybe it could be done). On the other hand, if we look at Python, Javascript (Node) and Java, then all three languages are perfectly suitable for a RESTful microservices. but according to the links below they have a hugely different energy consumption, so the choice then should lean to Java over python (as an example). We suggest to extend the considerations section with the following items:
|
Maybe we step this down a notch or two and suggest that the implementers should consider performance optimising hot-spots of their code in different directions, instead of advising them to choose this or that. Try to use:
Personally I still think this whole pattern will be a can-of-worms: Comparisons are very academic, good algorithms are faster even in slower languages and programming paradigms are very important (to a limit given by each domain). There are so many real world things to consider to master performance and green software (are these even synonyms?) |
…d-languages Using Complied Languages rather than Interpreted Languages #132
Describe the pattern you'd like to propose
Compiled languages “tend to be” the most energy-efficient - see paper linked in reference section.
Actions:
- Use a language as close to the machine as possible, example: c, cpp rather than python.
- Revise scripts/programs to replace e.g. python with e.g. cpp.
Describe specific emission impact from this pattern
Regarding SCI = ((E *I) * M) per R, E will decline with use of the likes of C/Cpp rather than Python.
More stats:
https://devblogs.microsoft.com/sustainable-software/language-impact-on-ui-apps/
References to this pattern
Compiled languages “tend to be” the most energy-efficient:
See table 3: https://greenlab.di.uminho.pt/wp-content/uploads/2017/10/sleFinal.pdf?utm_source=thenewstack&utm_medium=website&utm_campaign=platform
https://thenewstack.io/which-programming-languages-use-the-least-electricity/
Additional context
C is low level in the sense that it enables direct manipulation of the computer hardware (at least as direct as the OS will allow). The most common implementations of Python, Java, etc. are at least one step further removed from the hardware because they run in a VM. If you want to manipulate the hardware from Python you'll have write an extension to the Python VM, usually in C or C++. There's no virtual machine interpreting C executable code. It's compiled into machine instructions, specific to a particular CPU, that are linked together and run on your hardware
The text was updated successfully, but these errors were encountered: