Movatterモバイル変換


[0]ホーム

URL:


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
 
It seems that you've previously unsubscribed from our newsletterin the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to ourTerms of Use andPrivacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
 
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become aTNS follower on LinkedIn.

Check outthe latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
 
NEW! Try Stackie AI
PODCASTSEBOOKSEVENTSWEBINARSNEWSLETTERCONTRIBUTE
ARCHITECTUREENGINEERINGOPERATIONSPROGRAMMING
Throwing AI at Developers Won’t Fix Their Problems
Jul 11th 2025 4:00am, byChris Westerhold and Ankit Jain
Will LLMs and Vibe Coding Fuel a Developer Renaissance?
Jul 9th 2025 1:52pm, bySylvain Kalache
Introduction to Large Language Models (LLMs)
Jun 30th 2025 11:00am, byTNS Staff
How To Build an AI Health Care Agent on Amazon Bedrock
Jul 17th 2025 8:00am, byHafiz Hassan
Harnessing AI To Elevate Automated Software Testing
Jul 9th 2025 9:00am, byLindsay Farny
Driving Platform Adoption: The Missed Opportunity of Marketing
Jul 7th 2025 9:00am, byMichael Coté and Rita Manachi
MCP Vulnerability Exposes the AI Untrusted Code Crisis
Jul 7th 2025 6:00am, byDan Fernandez
Hypercloud Players Reveal Their Latest AI FinOps Products
Jun 9th 2025 11:28am, bySteven J. Vaughan-Nichols
Why Everyone Hates Your DevOps Stack
Jul 16th 2025 7:30am, byVicki Walker
Driving Platform Adoption, Part 2: Yes, Create T-Shirts To Tout Your Brand
Jul 15th 2025 8:00am, byMichael Coté and Rita Manachi
Let AI Hustle So Employees Can Lead
Jul 7th 2025 10:00am, byMike Szilagyi
Driving Platform Adoption: The Missed Opportunity of Marketing
Jul 7th 2025 9:00am, byMichael Coté and Rita Manachi
Kubernetes Finally Solves Its Biggest Problem: Managing Databases
Jul 14th 2025 1:00pm, byRotem Tamir and Gabriele Bartolini
6 Design Principles for Edge Computing Systems
Jul 17th 2025 7:00am, byJoab Jackson
Smarter AI for Critical Operations: Why Data Matters 
Jul 15th 2025 10:00am, byScott Bastek
The Grep Command in Linux
Jul 13th 2025 7:00am, byJack Wallen
Driving Platform Adoption, Part 2: Yes, Create T-Shirts To Tout Your Brand
Jul 15th 2025 8:00am, byMichael Coté and Rita Manachi
Enterprise Platform Teams Are Stuck in Day 2 Hell
Jul 14th 2025 12:03pm, byJennifer Riggins
Throwing AI at Developers Won’t Fix Their Problems
Jul 11th 2025 4:00am, byChris Westerhold and Ankit Jain
How AI Can Help You Learn the Art of Programming
Jun 20th 2025 9:00am, byJack Wallen
How to Build Multistep Forms in React
May 22nd 2025 12:00pm, byVinod Pal
Bjarne Stroustrup on How He Sees C++ Evolving
Mar 7th 2025 6:00am, byDavid Cassel
Enterprise Platform Teams Are Stuck in Day 2 Hell
Jul 14th 2025 12:03pm, byJennifer Riggins
Warp Goes Agentic: A Developer Walk-Through of Warp 2.0
Jul 12th 2025 6:05am, byDavid Eastman
10 Insights from Integrating AI into My Coding Workflow
Jul 11th 2025 5:05am, byDieter Randolph
Prepare Your Mac for Go Development
Apr 12th 2025 7:00am, byDamon M. Garn
Pagoda: A Web Development Starter Kit for Go Programmers
Mar 19th 2025 6:10am, byLoraine Lawson
Go Power: Microsoft's Bold Bet on Faster TypeScript Tools
Mar 12th 2025 1:00pm, byDarryl K. Taft and Loraine Lawson
Using Java for Developing Agentic AI Apps
Jul 1st 2025 8:00am, byDaniel Oh
Inside Java's Language Renaissance
Jun 26th 2025 10:00am, byChad Arimura
Async Programming in Java Repositories
Jun 13th 2025 1:00pm, bySimon Ritter
Java at 30: Java Pioneers Look Back, Forward
Jun 5th 2025 4:00pm, byDarryl K. Taft
Web Dev Kent Dodds on Remix and His Frontend Secret Weapon
Jul 15th 2025 12:30pm, byLoraine Lawson
Introduction to JavaScript
Jul 14th 2025 2:00pm, byTNS Staff
Hono Shows the Way for Microframeworks in a Post-React World
Jul 12th 2025 10:20am, byRichard MacManus
Creators of Nuxt.js and Nitro Join Vercel
Jul 11th 2025 10:05am, byLoraine Lawson
5 Underappreciated JavaScript Libraries To Try in 2025
Jul 10th 2025 12:00pm, byAlexander T. Williams
Python `apply()` vs. `apply_async()`: Which Should You Use?
Jul 16th 2025 10:00am, byJessica Wachtel
Convert Timestamps To Strings Like a Python Pro
Jul 14th 2025 11:00am, byJessica Wachtel
Python Indexing vs. For Loops: What’s Really Faster?
Jul 10th 2025 10:00am, byJessica Wachtel
How to Write Rust Code Like a Rustacean
Jul 9th 2025 6:05am, byZziwa Raymond Ian
Decode Any Python Code With This 5-Step Method
Jul 7th 2025 11:00am, byJessica Wachtel
Python `apply()` vs. `apply_async()`: Which Should You Use?
Jul 16th 2025 10:00am, byJessica Wachtel
Convert Timestamps To Strings Like a Python Pro
Jul 14th 2025 11:00am, byJessica Wachtel
Python Indexing vs. For Loops: What’s Really Faster?
Jul 10th 2025 10:00am, byJessica Wachtel
Decode Any Python Code With This 5-Step Method
Jul 7th 2025 11:00am, byJessica Wachtel
Build Your Own AI Terminal Chatbot in Minutes
Jul 3rd 2025 12:00pm, byJessica Wachtel
How to Write Rust Code Like a Rustacean
Jul 9th 2025 6:05am, byZziwa Raymond Ian
Do Frontend Frameworks Still Matter? A Thread
Jun 28th 2025 6:00am, byLoraine Lawson
Rust Eats Python's, Java’s Lunch in Data Engineering
Jun 19th 2025 1:00pm, byDarryl K. Taft
InfluxDB v3: Why Rust Beat Go for Time Series Database
Jun 5th 2025 10:00am, byB. Cameron Gain
2023-03-14 11:38:56
MIT-Created Compiler Speeds up Python Code
Python /Software Development /WebAssembly

MIT-Created Compiler Speeds up Python Code

Why compile Python? Because compiled Python achieves speeds 10 to 100 times faster than regular Python, MIT discovered.
Mar 14th, 2023 11:38am by
Featued image for: MIT-Created Compiler Speeds up Python Code
Image via Shutterstock

Python is a popular, beginner-friendly language. It’s also an interpreted language, which makes it easy to use but slower than a compiled language such as C or C++. At the large scale that becomes a problem, as Ariya Shajii, an MIT CSAIL Ph.D. graduate, and his colleague Ibrahim Numanagić noticed when working with genomics, which involved large data sequences.

They realized the previous efforts to create faster versions of Python were predicated on a top-down approach that started with the traditional implementation and then attempted to make it faster by doing a just-in-time compilation, which compiles the code as the program runs, Shajii said.

“The clear advantage of that is you can get a lot of backwards compatibility, but you’re really limited in the types of things you can do,” Shajii told The New Stack. “For example, Python has this thing called a global interpreter lock, which basically prevents you from doing parallel or multithreaded applications. And that’s a big problem if you really want high performance.”

Instead, Shajii and Numanagić took a bottom-up approach, implementing everything from the ground up, independent of the standard Python implementation, he said. That led them to an unusual approach: compiling Python with a tool they created, with an MIT team, called Codon.

“It gives you a lot more flexibility to do interesting things and generate optimized code, and things like that,” Shajii said. “That’s why we’re able to get such a better performance than some of these other compilation approaches, which maybe get 2 to 4 times, for example, but with Codon it’s usually like 10 to 100 times.”

The MIT team tested Codon on approximately ten commonly used genomics applications, all written in Python and compiled using Codon. The team achieved five to ten times speed-ups over the original hand-optimized implementations.

Codon’s Origin Story

Originally, Shajii and Numanagić planned to build a domain-specific language for genomics, since that was their background. What they found, however, is that people didn’twant to learn a new and specialized language — they like Python.

“That’s why we just made everything as Pythonic as possible,” he said. “Then over time, we just closed the gaps farther and farther to the point where we had sort of a general Python, sort of Python replacement pretty much.”

The team then refactored their tool into the Codon compiler by converting all its genomic-specific library, data structures, and methods of dealing with sequences into an extension. This approach allows Codon to support other domain-specific languages, which areprogramming languages with higher abstraction for a specific class of problems, all wrapped in a comfortable Python-like environment.

“The whole system is extensible with plugins, so you can write a plugin that has new libraries, new compiler optimizations; you can even add new keywords to the language if you want it to, or new syntax,” Shajii said. “But from the user standpoint, they’re still writing very high-level Pythonic code.”

One of the first puzzles the team had to solve was how to feed the compiler Python code. The compiler’s first step is to perform “type checking,” a process where the program figures out the different data types — string, integers, floating-point numbers, etc. — of each variable or function. Some might be strings, some might be integers. In regular Python, that information is dealt with as the program runs, which is one of the reasons Python is slow. Codon does this type-checking before running the program. Doing so allows the compiler to convert the code to native machine code, thus avoiding the overhead of dealing with data types at runtime.

They then focused on optimizations in the compiler.

“If you’re working with the genomics plugin, for example, that will do its own set of optimizations that are specific to that computing domain, which involves working with genomic sequences and other biological data, for example. The result? An executable file that runs at the speed of C orC++, or even faster once domain-specific optimizations are applied,” MIT stated.

Shajii and the team published apaper detailing how Codon works.

Compiling Python Caveats

There are a few caveats with compiling Python, however. Codon does not support dynamically changing data types at runtime, for instance.

“We said, okay, we’re targeting scientific applications, and it’s rare to do stuff like that, so let’s just like shift our focus to statically analyzable things,” Shajii explained. “So some of those dynamic features we don’t support.”

Some of these omitted features are on Codon’s roadmap to support and some aren’t. For instance, standard library modules aren’t supported yet, but the MIT team is working on it.

“It’s a huge, huge library, but we’ve tried to implement the main ones that we typically see used […] in the kinds of applications that we’re targeting,” he said.

There are also data type differences. For example, integers in Codon are 64 bit and in Python they’re “arbitrarily long,” he said.

Also, while Codon is designed to help projects scale up, don’t expect a seamless output yet.

“Larger code bases, you’ll probably end up having some [of the] incompatibilities that I mentioned. So, you know, oftentimes we give you error messages: that you need to go and change this, or [we] don’t support this yet,” he said.

There are other ways to use Codon in larger Python applications, he said, noting that there is a decorator that allows developers to allow one particular function — say a bottleneck — to compile while everything else stays in Python.

“That’s to address this problem of an all-or-nothing approach,” he said. “Often, if you have some Python application, what people would typically do is they would write the really performance-critical pieces of that in C; or Cython, for example, is another tool that’s used for that. So we’re releasing something pretty soon that lets you do that same thing in Codon, so you never have to leave the Python environment, which, again, is sort of the underlying theme of all this.”

Codon’s Coming Soon: WebAssembly and More

Codon was released in December and is in version 0.15. It’s available for free usage in academic or personal applications.

The team wants to incorporate several dynamic features and expand its Python library coverage. There’s one planned feature, however, that may appeal to frontend and web developers: They’ve planned to support compiling to WebAssembly.

“We use LLVM as a backend. LLVM is a very common sort of compiler infrastructure/framework that a lot of compilers use, and LLVM has support for WebAssembly,” he said. “So one of the things that we plan to add support for is WebAssembly for Codon, so [that] you can take a Python program and compile it to WebAssembly.”

TRENDING STORIES
GroupCreated with Sketch.
Loraine Lawson is a veteran technology reporter who has covered technology issues from data integration to security for 25 years. Before joining The New Stack, she served as the editor of the banking technology site Bank Automation News. She has...
Read more from Loraine Lawson
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTERReceive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to ourTerms of Use andPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp