Home  >  Article  >  Technology peripherals  >  If you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI

If you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI

王林
王林Original
2024-08-07 19:39:13924browse

In recent years, there is a programming language that is ubiquitous, and everyone knows its name. It is even preached on the Internet that one can become a programming master by learning it. It is Python. Learning Python is like a treasure: it is easy to read and write, has strong compatibility, rich libraries, and a wide range of uses. It has become very popular in the era of data and machine learning. However good it is, Python still has its own drawbacks, that is, it is too slow! There are many programming languages, such as C++, Fortran and Java, which are the more famous ones. Programs written in Python are notoriously slow compared to them. A team of computer scientists at the University of Massachusetts Amherst, led by Emery Berger, has launched a Python profiler called Scalene. The related research "Triangulating Python Performance Issues with SCALENE" won the Best Paper Award at the USENIX Operating System Design and Implementation Conference (OSDI). Emery Berger said that Python is 100 to 1000 times slower than other languages, and some tasks can take 60,000 times longer in Python. And Scalene is effective at identifying exactly where Python is lagging, allowing programmers to troubleshoot and simplify code for higher performance. The project is also open source and has nearly 100,000 GitHub stars.

If you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI

1. Project address: https://github.com/plasma-umass/scalene
  1. Paper address: https://arxiv.org/pdf/2212.07597.pdf

Scalene: High-performance Python analysis Python is known for its inefficiency. To solve this problem, programmers can use profilers to identify inefficient areas in their programs.

Scalene is a high-performance CPU, GPU and memory profiler for Python. It does things that no other Python analyzer can do. Scalene runs orders of magnitude faster than other profilers and provides more detailed information. It’s also the first profiler to use AI for optimization recommendations.

Computer speeds are no longer improving, and future speed improvements will rely more on efficient programming rather than hardware.

Scalene is fast and accurate. It uses sampling rather than instrumentation or relying on Python's tracing tools. The overhead is usually no more than 10-20% (usually less).

Usage Guide First, you need to enter the OpenAI key.

If you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI

After entering a valid key, click the bolt (⚡) next to any line or the explosion (?) of the entire code area to generate suggested optimizations. Click a suggested optimization to copy it to your clipboard.

If you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI

Optimization suggestionsIf you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI

You can click on bolt or explosion multiple times to generate different optimization suggestions.
  • About Emery Berger

Emery Berger is a professor in the School of Information and Computer Science at the University of Massachusetts Amherst. He received his PhD in computer science from the University of Texas at Austin in 2002.

Professor Berger has served as a visiting scientist at Microsoft Research and the Polytechnic University of Catalonia (UPC)/Barcelona Supercomputing Center (BSC). His research interests include programming languages, runtime systems, and operating systems, with a particular focus on improving system reliability, security, and performance.

The above is the detailed content of If you think Python is slow, this AI analyzer will help you detect and suggest optimizations, and won the best paper in OSDI. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn