From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org, Chun-Yu Shei <cshei@google.com>
Cc: Michael 'veremitz' Everitt <gentoo@veremit.xyz>,
Sid Spry <sid@aeam.us>, Zac Medico <zmedico@gentoo.org>
Subject: Re: [gentoo-portage-dev] [PATCH 1/3] Add caching to catpkgsplit function
Date: Mon, 6 Jul 2020 11:03:56 -0700 [thread overview]
Message-ID: <56f09700-2d1a-f150-e484-5154d03bd215@gentoo.org> (raw)
In-Reply-To: <CAP=_c=0ZsWsmuEZgN8rHjpXQx+=GGT=DGUPgigcnYCURoK4B4w@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1649 bytes --]
On 7/6/20 10:30 AM, Chun-Yu Shei wrote:
> I finally got a chance to try Sid's lru_cache suggestion, and the
> results were really good. Simply adding it on catpkgsplit and moving
> the body of use_reduce into a separate function (that accepts tuples
> instead of unhashable lists/sets) and decorating it with lru_cache
> gets a similar 40% overall speedup for the upgrade case I tested. It
> seems like even a relatively small cache size (1000 entries) gives
> quite a speedup, even though in the use_reduce case, the cache size
> eventually reaches almost 20,000 entries if no limit is set. With
> these two changes, adding caching to match_from_list didn't seem to
> make much/any difference.
That's great!
> The catch is that lru_cache is only available in Python 3.2, so would
> it make sense to add a dummy lru_cache implementation for Python < 3.2
> that does nothing? There is also a backports-functools-lru-cache
> package that's already available in the Portage tree, but that would
> add an additional external dependency.
>
> I agree that refactoring could yield an even bigger gain, but
> hopefully this can be implemented as an interim solution to speed up
> the common emerge case of resolving upgrades. I'm happy to submit new
> patches for this, if someone can suggest how to best handle the Python
> < 3.2 case. :)
>
> Thanks,
> Chun-Yu
We can safely drop support for < Python 3.6 at this point. Alternatively
we could add a compatibility shim for Python 2.7 that does not perform
any caching, but I really don't think it's worth the trouble to support
it any longer.
--
Thanks,
Zac
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
next prev parent reply other threads:[~2020-07-06 18:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-27 6:34 [gentoo-portage-dev] Add caching to a few commonly used functions Chun-Yu Shei
2020-06-27 6:34 ` [gentoo-portage-dev] [PATCH 1/3] Add caching to catpkgsplit function Chun-Yu Shei
2020-06-27 11:33 ` Michał Górny
2020-06-29 1:58 ` Sid Spry
2020-07-06 15:26 ` Francesco Riosa
[not found] ` <cdb0d821-67c1-edb6-2cbc-f26eaa0d3d70@veremit.xyz>
2020-07-06 16:10 ` Francesco Riosa
2020-07-06 17:30 ` Chun-Yu Shei
2020-07-06 18:03 ` Zac Medico [this message]
2020-07-07 3:41 ` Zac Medico
2020-07-09 7:03 ` Chun-Yu Shei
2020-07-09 7:03 ` [gentoo-portage-dev] [PATCH] Add caching to use_reduce, vercmp, and catpkgsplit Chun-Yu Shei
2020-07-12 21:46 ` Zac Medico
2020-07-13 6:30 ` [gentoo-portage-dev] [PATCH] Add caching to use_reduce, Chun-Yu Shei
2020-07-13 6:30 ` [gentoo-portage-dev] [PATCH] Add caching to use_reduce, vercmp, and catpkgsplit Chun-Yu Shei
2020-07-13 17:28 ` Zac Medico
2020-07-13 18:54 ` Ulrich Mueller
2020-07-13 19:04 ` Chun-Yu Shei
2020-07-13 19:24 ` Ulrich Mueller
2020-07-09 21:04 ` [gentoo-portage-dev] [PATCH 1/3] Add caching to catpkgsplit function Alec Warner
2020-07-09 21:06 ` Chun-Yu Shei
2020-07-09 21:13 ` Alec Warner
2020-06-27 6:34 ` [gentoo-portage-dev] [PATCH 2/3] Add caching to use_reduce function Chun-Yu Shei
2020-06-27 6:34 ` [gentoo-portage-dev] [PATCH 3/3] Add partial caching to match_from_list Chun-Yu Shei
2020-06-27 7:35 ` [gentoo-portage-dev] Add caching to a few commonly used functions Fabian Groffen
2020-06-27 7:43 ` Chun-Yu Shei
2020-06-27 8:31 ` Kent Fredric
2020-06-28 3:00 ` Zac Medico
2020-06-28 3:12 ` Michał Górny
2020-06-28 3:42 ` Zac Medico
2020-06-28 5:30 ` Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56f09700-2d1a-f150-e484-5154d03bd215@gentoo.org \
--to=zmedico@gentoo.org \
--cc=cshei@google.com \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=gentoo@veremit.xyz \
--cc=sid@aeam.us \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox