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.
- Nov 1, 2026Voice bots built on LLMs turn to Jev, a fast classifier, for decisions in 200–500 ms
- Nov 1, 2026Local AI models agreed to pay scammers, while simple rules blocked all 42 schemes
- Oct 31, 2026A 22B-Parameter Video Model Runs on an RTX 3080 with 10 GB of VRAM
- Oct 30, 2026Mistral opens Large 4 weights: strong at code, but Chinese models score 32 to its 26
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. 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 ch
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
Build & Ship Production AI Agents Without Boilerplate Code
Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.