1 |
On Sun, Mar 12, 2017 at 2:13 PM, Michał Górny <mgorny@g.o> wrote: |
2 |
> W dniu 12.03.2017, nie o godzinie 13∶36 -0700, użytkownik Zac Medico |
3 |
> napisał: |
4 |
>> On Sun, Mar 12, 2017 at 11:59 AM, Michał Górny <mgorny@g.o> wrote: |
5 |
>> > Use get_valid_checksum_keys() function instead of accessing hashfunc_map |
6 |
>> > directly throughout the Portage. |
7 |
>> > --- |
8 |
>> > pym/portage/_emirrordist/FetchTask.py | 2 +- |
9 |
>> > pym/portage/dbapi/bintree.py | 4 ++-- |
10 |
>> > pym/portage/eclass_cache.py | 2 +- |
11 |
>> > pym/portage/manifest.py | 4 ++-- |
12 |
>> > pym/portage/package/ebuild/fetch.py | 10 +++++----- |
13 |
>> > 5 files changed, 11 insertions(+), 11 deletions(-) |
14 |
>> > |
15 |
>> > diff --git a/pym/portage/_emirrordist/FetchTask.py b/pym/portage/_emirrordist/FetchTask.py |
16 |
>> > index 64de67582..203b8c213 100644 |
17 |
>> > --- a/pym/portage/_emirrordist/FetchTask.py |
18 |
>> > +++ b/pym/portage/_emirrordist/FetchTask.py |
19 |
>> > @@ -574,7 +574,7 @@ class FetchTask(CompositeTask): |
20 |
>> > else: |
21 |
>> > for hash_name in self.digests: |
22 |
>> > if hash_name != "size" and \ |
23 |
>> > - hash_name in portage.checksum.hashfunc_map: |
24 |
>> > + hash_name in portage.checksum.get_valid_checksum_keys(): |
25 |
>> |
26 |
>> The get_valid_checksum_keys function creates a list for each call, so |
27 |
>> this is a lot less efficient that dict hash table lookup that it was |
28 |
>> before. |
29 |
> |
30 |
> Does it really matter though? AFAICS this is just a matter of optimizing |
31 |
> the function, e.g. putting the keys in a frozenset. |
32 |
|
33 |
It's going to be most convenient if get_valid_checksum_keys returns a frozenset. |
34 |
-- |
35 |
Thanks, |
36 |
Zac |