You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Profiling with psutil directly in code
Reading RAM and CPU used
Completion of 100,000,000 cycles to amplify impacts
Application of the formula for calculating the CO2 equivalent present on this url: https://boavizta.org/blog/empreinte-de-la-fabrication-d-un-serveur
servermanufgwp(kgCO2eq) = servertypegwp(kgCO2eq) + cpuunits(unit) x cpubasegwp(kgCO2eq/unit) + ramsize(GB) x ramsizegwp(kgCO2eq/GB)
Calculating the differential between code implementing bad code and code implementing good code practice
Validation
The rule is validated by the measurement.
Link to the code used to validate the rule: https://github.com/JulienPlanque/python-profiling
Validation result
Launching the container for the AvoidListComprehensionInIterationsBad.py script...
4493365500.0
Launching the container for the AvoidListComprehensionInIterationsGood.py script...
4478423217.0
Calculation of deltas:
Delta between bad practice and good code practice for rule AvoidListComprehensionInIterations: 14942283
The text was updated successfully, but these errors were encountered:
[PYTHON] Avoid List Comprehension In Iterations
Associated rule link
https://github.com/green-code-initiative/ecoCode/blob/main/ecocode-rules-specifications/src/main/rules/EC404/python/EC404.asciidoc
Language and platform
Example:
Python
Itel proc 12th Gen Core i7-1255U 1,7 GHz
Docker container : python:3.9-slim
memory = 4go
swap = 6go
cpu=2
Measure justification
Profiling with psutil directly in code
Reading RAM and CPU used
Completion of 100,000,000 cycles to amplify impacts
Application of the formula for calculating the CO2 equivalent present on this url: https://boavizta.org/blog/empreinte-de-la-fabrication-d-un-serveur
servermanufgwp(kgCO2eq) = servertypegwp(kgCO2eq) + cpuunits(unit) x cpubasegwp(kgCO2eq/unit) + ramsize(GB) x ramsizegwp(kgCO2eq/GB)
Calculating the differential between code implementing bad code and code implementing good code practice
Validation
The rule is validated by the measurement.
Link to the code used to validate the rule: https://github.com/JulienPlanque/python-profiling
Validation result
Launching the container for the AvoidListComprehensionInIterationsBad.py script...
4493365500.0
Launching the container for the AvoidListComprehensionInIterationsGood.py script...
4478423217.0
Calculation of deltas:
Delta between bad practice and good code practice for rule AvoidListComprehensionInIterations: 14942283
The text was updated successfully, but these errors were encountered: