[Yum-devel] [PATCH 1/2] Don't cache the hdr, it's just not measurable speed wise and they are BIG.

Panu Matilainen pmatilai at laiskiainen.org
Mon Feb 21 17:34:20 UTC 2011


On 02/21/2011 07:20 PM, James Antill wrote:
> On Mon, 2011-02-21 at 19:05 +0200, Panu Matilainen wrote:
>> On 02/21/2011 06:34 PM, James Antill wrote:
>>> +        if varname != 'hdr': # Don't cache the hdr, unless explicitly requested
>
>> The question to me is, is there actually ever a "valid" case to cache
>> the header in the package object? If somebody asks fo po.hdr, they
>> already get a reference to it, and can then do whatever they please with
>> it. Eg
>
>   My assumption is that we didn't want to break:
>
> hdr = po.hdr
> # [...]
> if id(hdr) == id(po.hdr):
>
> ...and while I doubt there's anything that will break if we change that,
> I also doubt there should be any callers accessing .hdr directly (at
> least ones who don't need to be fixed :). And having the problem from
> the bad assumption be that we use more memory (rather than do something
> wrong) should make Seth happier :).
>   The fact the changelog plugin currently does "times =
> po.hdr['changelogtime']" is unfortunate, but can be fixed easily.
>
>   You disagree with any of the above?

No disagreement, but maybe po.hdr should be then marked deprecated as a 
hint to callers that they should really be using something else instead.

The changelog thing might well be from dark ages when that was the only 
way of accessing the data - dunno, it's been a while :)

	- Panu -


More information about the Yum-devel mailing list