遇见数据集

GCI82 – Make Variable Constant (Energy Analysis in Python)

收藏
Zenodo2026-04-24 更新2026-05-26 收录
官方服务:

资源简介:

Description This repository presents an empirical energy consumption analysis of the Creedengo rule GCI82 – Make Variable Constant for Python. The rule suggests that variables assigned only once should be written using uppercase naming conventions to indicate constant values. The objective of this study is to evaluate whether applying this rule has a measurable impact on energy consumption. Methodology Two versions of Python programs were implemented: a version with the CODE SMELL where variables assigned once are not written in uppercase, a version without the CODE SMELL where such variables follow the constant naming convention. Energy measurements were collected using the energyTracer tool on Apple Silicon, capturing CPU and DRAM, ... usage across multiple runs and a large number of iterations. Key Insights The results show that: energy differences between compliant and non-compliant versions are small and inconsistent, observed variations are likely influenced by runtime effects such as caching, execution order, and garbage collection, no clear evidence indicates that the rule itself leads to direct energy savings in Python. Conclusion The GCI82 rule does not appear to provide a direct energy optimization in Python as the language does not enforce constant semantics at runtime. Its primary benefit lies in improving code readability and maintainability which may indirectly support better software practices but without a measurable direct impact on energy consumption in this context.

提供机构:
Zenodo
创建时间:
2026-04-24
二维码
社区交流群
二维码
科研交流群
商业服务