Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The message said that Python will add "Immortal Objects", which can improve memory efficiency and remove parallel computing restrictions.

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > IT Information >

Share

Shulou(Shulou.com)11/24 Report--

CTOnews.com, August 22, Meta recently announced that it will add Immortal Objects to Python so that objects can bypass reference count checks and become "immortal objects" that continue to survive during execution, thus improving the efficiency of memory use and helping to remove the limitations of the Python language itself in parallel operations.

CTOnews.com found that Meta uses Python web page framework Django to develop Instagram front-end, and uses multi-program architecture and Python function library asyncio to achieve the goal of parallel processing of each program, but because the scale of Instagram front-end is very large in terms of business logic and the amount of requests processed, developers currently apply this method, resulting in a large demand for memory, resulting in a series of performance obstacles in the system.

The PEP-683 proposed by Meta, the source of ▲ graphics, has been adopted at present. With the operation of the system, the use of private memory of each server program increases, while the shared memory decreases, which leads to memory inefficiency.

The developer analyzed and found that even though many Python objects are immutable throughout execution, Python's reference counting and garbage collection mechanism still attempts to manage and modify these objects, and the Copy-On-Write,COW step is still performed during each read and garbage collection cycle, making the original shared memory paging private, thus reducing shared memory efficiency. This results in unnecessary CPU and memory costs.

▲ uses Immortal Objects to improve memory and CPU efficiency the current Meta is to solve this problem, so it is announced that Immortal Objects,Immortal Objects will be added to the Python in the reference count field of the object, marking special values to create "immortal objects", that is, "core object state will never change". Runtime will know when it is possible or impossible to change the reference count field and garbage collection head.

In the Instagram front-end, developers used to improve memory and CPU efficiency by "reducing copy operations on write". Now, with the addition of Immortal Objects, Instagram front-end can significantly reduce the use of private memory by increasing the use of shared memory.

Because Immortal Objects can share objects across threads, there is no need for GIL (Global Interpreter Lock) to achieve thread safety. Meta believes that this feature is expected to promote the development of the Python language, and because Immortal Objects ensures the true immutability of heap objects, it can also remove a series of restrictions of Python in parallel computing.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

IT Information

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report