Python in AI: why a language 70 times slower than C is losing ground at the edge
The AI industry, the most resource-hungry in history, does most of its computing in Python. The language is roughly 70 times slower than C and ranks 26th out of 27 in an energy-efficiency ranking of programming languages. In on-device and edge inference, compiled languages are already pushing Python aside, with Swift leading the way.
AI-processed from Habr AI; edited by Hamidun News
The AI industry, the most compute-hungry in history, does most of its computing in Python, a programming language that is roughly 70 times slower than C and ranks 26th out of 27 in an energy-efficiency ranking of programming languages.
What Python's crown costs
An author on Habr breaks down the cost of this choice along three dimensions: microseconds of compute, gigawatt-hours of data center energy, and the doubled workload of engineers who have to make up for the language's slowness with extra optimization and wrappers around faster libraries. The piece relies on numbers and links to primary sources, and it also examines fair counterarguments in Python's favor, so it doesn't simply blame the language for every problem the industry has.
Why the industry chose Python anyway
Python's dominance in machine learning is a product of history: a huge library ecosystem grew up around the language, and in practice the "slow" part of the code almost always hands off the heavy lifting to fast C and CUDA implementations under the hood. But as workloads shift from training large models in the cloud to running them on the user's side, that architectural decision starts working against the industry.
As long as training and inference ran mostly in data centers on powerful GPU clusters, Python's overhead disappeared against the overall cost of compute. That changes when a model has to run on a smartphone, a laptop, or an embedded device with a tight power budget. There, the gap between interpreted and compiled execution becomes critical for response time and battery life, rather than just a line item in a data center energy report.
Where Python is already losing ground
As AI model inference moves onto user devices, with on-device and edge scenarios and local inference that never calls out to the cloud, Python's position is weakening. Compiled languages are already claiming this new territory, Swift first among them, since it has an edge in execution speed and power consumption in these scenarios.
- Python is roughly 70 times slower than C
- Python ranks 26th out of 27 in an energy-efficiency ranking of programming languages
- The cost of Python's dominance is measured in microseconds, gigawatt-hours, and engineering labor
- In on-device and edge inference, compiled languages, Swift first among them, are pushing Python aside
What this cost means for data centers
The gigawatt-hours in this comparison aren't an abstraction. Interpreted Python needs more compute cycles than compiled code for the same task, which means more electricity to power and cool the servers. The doubled engineering effort is the price of constant layering: wrapping Python code around faster C and CUDA libraries, profiling bottlenecks, and rewriting critical sections at a lower level to compensate for the language's own slowness.
What it means
Python remains the default language for training and prototyping AI models. But as inference moves to local devices and edge scenarios, where every milliwatt and millisecond counts, its cost becomes harder to ignore, and that is exactly where compiled languages have a chance to unseat the long-time leader. This isn't about replacing Python entirely in the coming years. It's about a gradual split in use cases: the cloud and prototyping stay with Python, while edge and on-device work increasingly moves to compiled alternatives such as Swift.
- Dec 2, 2026Amazon to Speed Up Ergo From 400 to 2,200 Tokens per Second and Buy 2 Million More Nvidia GPUs
- Dec 2, 2026Canonical Releases Ubuntu 26.04 for RTX Spark Laptops with 128 GB of Shared Memory
- Dec 2, 2026Vidu S2 streams AI video in real time: 720p, 25–42 fps, and on-the-fly outfit swaps
- Dec 2, 2026AI-Written Rust Driver for NVIDIA Boosts Tesla V100 Memory by 26.8%
Key Questions Answered
What Python's crown costs?
An author on Habr breaks down the cost of this choice along three dimensions: microseconds of compute, gigawatt-hours of data center energy, and the doubled workload of engineers who have to make up for the language's slowness with extra optimization and wrappers around faster libraries. The piece relies on numbers and links to primary sources, and it also examines fair counterarguments in Python's favor, so it doesn't simply blame the language for every problem the industry has.
Why the industry chose Python anyway?
Python's dominance in machine learning is a product of history: a huge library ecosystem grew up around the language, and in practice the "slow" part of the code almost always hands off the heavy lifting to fast C and CUDA implementations under the hood. But as workloads shift from training large models in the cloud to running them on the user's side, that architectural decision starts working against the industry.
Where Python is already losing ground?
As AI model inference moves onto user devices, with on-device and edge scenarios and local inference that never calls out to the cloud, Python's position is weakening. Compiled languages are already claiming this new territory, Swift first among them, since it has an edge in execution speed and power consumption in these scenarios.
Ship AI Faster with Founders, Engineers & Weekly Architecture Reviews
Inside Vibe Club (hamidun.com/club) — weekly live masterminds with Zhemal Khamidun, Tech Radar, full LMS access, and 370+ production Claude Code skills.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
