Re: [gentoo-portage-dev] [PATCH 2/2] Add caching to _slot_operator_check_reverse_dependencies
On 11/24/22 19:36, Pin-yen Lin wrote: Add lru_cache to speed up the running time of "Calculating dependencies". In a ChromeOS use case, this patch decreases the running time from 311s to 197s with almost no memory usage increase. Signed-off-by: Pin-yen Lin --- lib/_emerge/depgraph.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index ce6cabcc1..9649bb2a8 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -2240,6 +2240,7 @@ class depgraph: return None +@functools.lru_cache(maxsize=100) def _slot_operator_check_reverse_dependencies( self, existing_pkg, candidate_pkg, replacement_parent=None ): Merged. Thank you! https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c42cc962e1926ecbdc83d903a2804f9e037f2a9 https://gitweb.gentoo.org/proj/portage.git/commit/?id=839ab46be1777e5886da28b98b53a462b992c5bf -- Thanks, Zac
Re: [gentoo-portage-dev] [PATCH 2/2] Add caching to _slot_operator_check_reverse_dependencies
On Thu, Nov 24, 2022 at 10:36 PM Pin-yen Lin wrote: > > Add lru_cache to speed up the running time of "Calculating > dependencies". > > In a ChromeOS use case, this patch decreases the running time from > 311s to 197s with almost no memory usage increase. > > Signed-off-by: Pin-yen Lin Thank you! With recent subslot rebuilds (icu, boost, poppler), I measure an improvement of 19%! Benchmark 1: emerge @world -vuNDp Time (mean ± σ): 42.668 s ± 0.555 s[User: 42.095 s, System: 0.315 s] Range (min … max): 41.572 s … 43.342 s10 runs Benchmark 2: emerge @world -vuNDp Time (mean ± σ): 35.991 s ± 0.154 s[User: 35.409 s, System: 0.332 s] Range (min … max): 35.831 s … 36.306 s10 runs Summary 'emerge @world -vuNDp' ran 1.19 ± 0.02 times faster than 'emerge @world -vuNDp'