Python's Global Interpreter Lock prevents execution on more than one CPU core at the same time, even when multiple threads are used. However, starting with Python 3.13 an experimental build allows disabling the GIL. While prior work has examined speedup implications of this disabling, the effects on energy consumption and hardware utilization have received less attention. This study measures execution time, CPU utilization, memory usage, and energy consumption using four workload categories: NumPy-based, sequential kernels, threaded numerical workloads, and threaded object workloads, comparing GIL and free-threaded builds of Python 3.14.2. The results highlight a trade-off. For parallelizable workloads operating on independent data, the free-threaded build reduces execution time by up to 4 times, with a proportional reduction in energy consumption, and effective multi-core utilization, at the cost of an increase in memory usage. In contrast, sequential workloads do not benefit from removing the GIL and instead show a 13-43% increase in energy consumption. Similarly, workloads where threads frequently access and modify the same objects show reduced improvements or even degradation due to lock contention. Across all workloads, energy consumption is proportional to execution time, indicating that disabling the GIL does not significantly affect power consumption, even when CPU utilization increases. When it comes to memory, the no-GIL build shows a general increase, more visible in virtual memory than in physical memory. This increase is primarily attributed to per-object locking, additional thread-safety mechanisms in the runtime, and the adoption of a new memory allocator. These findings suggest that Python's no-GIL build is not a universal improvement. Developers should evaluate whether their workload can effectively benefit from parallel execution before adoption.


翻译:暂无翻译

0
下载
关闭预览

相关内容

Python是一种面向对象的解释型计算机程序设计语言,在设计中注重代码的可读性,同时也是一种功能强大的通用型语言。
流畅的Python 中英文版 PDF 高清电子书
专知会员服务
83+阅读 · 2020年8月2日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
228+阅读 · 2020年3月22日
【新书】Python中的经典计算机科学问题,224页pdf
专知会员服务
149+阅读 · 2019年12月28日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
164+阅读 · 2019年10月12日
【新书】Python编程基础,669页pdf
专知会员服务
197+阅读 · 2019年10月10日
Python机器学习课程(代码与教程)
专知
37+阅读 · 2019年5月13日
资源 | Python 中文书籍大集合
AI研习社
13+阅读 · 2018年12月20日
荐书丨Python数据分析从入门到精通
程序人生
18+阅读 · 2018年3月31日
福利 | 当Python遇上大数据与机器学习,入门so easy!
这几本Python新书特别赞
图灵教育
21+阅读 · 2018年3月1日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Arxiv
0+阅读 · 3月10日
VIP会员
相关VIP内容
流畅的Python 中英文版 PDF 高清电子书
专知会员服务
83+阅读 · 2020年8月2日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
228+阅读 · 2020年3月22日
【新书】Python中的经典计算机科学问题,224页pdf
专知会员服务
149+阅读 · 2019年12月28日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
164+阅读 · 2019年10月12日
【新书】Python编程基础,669页pdf
专知会员服务
197+阅读 · 2019年10月10日
相关资讯
Python机器学习课程(代码与教程)
专知
37+阅读 · 2019年5月13日
资源 | Python 中文书籍大集合
AI研习社
13+阅读 · 2018年12月20日
荐书丨Python数据分析从入门到精通
程序人生
18+阅读 · 2018年3月31日
福利 | 当Python遇上大数据与机器学习,入门so easy!
这几本Python新书特别赞
图灵教育
21+阅读 · 2018年3月1日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员