Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 747016 - sys-apps/portage: allow configurable lru_cache scaling
Summary: sys-apps/portage: allow configurable lru_cache scaling
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-07 08:36 UTC by Jason A. Donenfeld
Modified: 2020-10-10 06:38 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason A. Donenfeld archtester Gentoo Infrastructure gentoo-dev Security 2020-10-07 08:36:12 UTC
The recent addition of these lines resulted in a big performance boost:

lib/portage/dep/__init__.py
20:from functools import lru_cache
402:@lru_cache(1024)
lib/portage/versions.py
13:from functools import lru_cache
111:@lru_cache(1024)
309:@lru_cache(10240)

The values 1024 and 10240 were chosen for some trade-off of speed and ram usage. However, with 64 gigs of ram, my trade-offs might be different than your trade-offs. Therefore, I propose a user-configurable scaling knob, PORTAGE_LRU_CACHE_SCALING_FACTOR. These would then be used like:

    @lru_cache(1024 * PORTAGE_LRU_CACHE_SCALING_FACTOR)

This way, users with excess ram could trade it for a performance boost.


Reproducible: Always
Comment 1 Zac Medico gentoo-dev 2020-10-10 06:38:26 UTC
We can hook this into the portage.data._init(settings) function which is used to initialize things with user configuration settings.