Gentoo Project has introduced Portage 3.0 package management system

Stabilized release of the package management system Portage 3.0, used in the distribution Gentoo Linux. The presented branch concluded a long effort to transition to Python 3 and end support for Python 2.7.

In addition to ending support for Python 2.7, another significant change was the inclusion of optimizations, which allowed for a 50-60% speedup in computations related to dependency resolution. Interestingly, some developers suggested rewriting the dependency resolution code in C/C++ or Go for improved performance, but the issue was resolved with minimal effort.

Profiling the existing code showed that the majority of the time during computations was spent on calls to the functions use_reduce and catpkgsplit with a recurring set of arguments (e.g., the function catpkgsplit was called between 1 to 5 million times). To speed things up, caching the results of these functions was implemented using dictionaries. The built-in function lru_cache was optimal for storing the cache, but it was only available in releases of Python from 3.2 onward. For compatibility with earlier versions, a stub was added to replace lru_cache, but the decision to end support for Python 2.7 in Portage 3.0 greatly simplified the task and allowed us to forgo this intermediary.

Using the cache reduced the execution time of the command "emerge -uDvpU —with-bdeps=y @world" on a ThinkPad X220 laptop from 5 minutes 20 seconds to 3 minutes 16 seconds (63%). Tests on other systems demonstrated a performance increase of no less than 48%.

The developer who prepared the change also attempted to implement a prototype of the dependency resolution code in C++ or Rust, but the task proved too complex as it required porting a significant amount of code, and it was questionable whether the end result would be worth the effort expended.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster