summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2024-02-13 15:45:51 -0500
committerSam James <sam@gentoo.org>2024-02-16 20:12:49 +0000
commit6aef2c5968d66e91dc083820db489d85697f3587 (patch)
tree58de30dac973c49c074937c4da31f462298d95dc /man
parentc0300517671076db453204c796637e206bf977e5 (diff)
downloadgentoolkit-6aef2c5968d66e91dc083820db489d85697f3587.tar.gz
dependencies.py: replace hand rolled depcache with functools.cache
functools.cache caches the output of functions "automatically" without requiring any manual management of a cache value. When used on class methods, the cache is associated with each class instance and only lives as long as the instance does. The Dependencies.graph_reverse_depends method used a dict to cache the output from pkg.get_all_depends. The get_all_depends method involves calling portage's aux_get and parsing the DEPEND string that is returned by it. This dict has been removed and replaced with functools.cache. The graph_reverse_depends method did not cache the output of the "raw=True" get_all_depends calls. This "raw" output is the literal string value for the pkgdeps *DEPEND variables as returned by aux_get. Searching this for a category/package sub-string allows quickly ruling out non-matching pkgdeps, which allows skipping parsing the DEPEND string into a list of Atoms. Using functools cache the method that fetches the raw DEPEND string massively improves performance for graph_reverse_depends when searching for indirect reverse dependencies. "equery depends --indirect emacs" runtime is ~2s with the raw value being cached, and ~60s without. Searching for only direct reverse dependencies does not utilize the cache and does not see any chance in runtime for me. Signed-off-by: John Turner <jturner.usa@gmail.com> Closes: https://github.com/gentoo/gentoolkit/pull/44 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'man')
0 files changed, 0 insertions, 0 deletions