[Freeipa-devel] [PATCH] 1 Do lazy initializiation ipalib

Simo Sorce simo at redhat.com
Mon Oct 31 13:03:33 UTC 2011


On Mon, 2011-10-31 at 14:19 +0200, Alexander Bokovoy wrote:
> On Mon, 31 Oct 2011, Jan Cholasta wrote:
> > Added finalization for __call__ and the check for CLI. Patch attached.
> ACK from my side but see below.
> 
> > +    def __getattribute__(self, name):
> > +        if not name.startswith('_Plugin__') and not name.startswith('_ReadOnly__') and name != 'finalize_late':
> > +            self.finalize_late()
> > +        return object.__getattribute__(self, name)
> Could you get faster than three string comparisons? As 
> __getattribute__ is fairly often called it would make sense to keep 
> these operations to absolute minimum.

How common it is for name to match the above expressions ?
If they always match then yes, we have an issue with the full strings
being compared fully each time. If they seldom match and the name
normally differ from the very first characters then these string
comparisons would be really quick and not too worrying.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the Freeipa-devel mailing list