← Back to team overview

launchpad-dev team mailing list archive

Re: What about non-DB performance?

 

On Fri, Aug 13, 2010 at 10:59 AM, Free Ekanayaka
<free.ekanayaka@xxxxxxxxxxxxx> wrote:
> Hi,
>
> |--==> On Fri, 13 Aug 2010 10:39:56 +1200, Robert Collins <robert.collins@xxxxxxxxxxxxx> said:
>
>  [...]
>
>  > Storm ReferenceSets don't (currently) permit constraints, so while we
>  > can write a collection for *all* signatures a person has made, we
>  > can't tell storm how to calculate the attribute for us. We could layer
>  > it:
>  > signatures = ReferenceSet(..)
>  > @property
>  > def is_ubuntu_coc_signer(self):
>  >     return bool(signature for signature in self.signatures
>  >         if signature.active and signature > lastcocdate)
>
> Hum, I might be totally off here, but isn't this somehow addressed by
> BoundReferenceSet.find?
>
> Like:
>
>  @property
>  def is_ubuntu_coc_signer(self):
>     result = self.signatures.find(active=True, *your_other_constraints)
>     return bool(result.one())

IFF that *never executes SQL*.

(Remember the context here: we want to make things that look cheap
(properties) be cheap.

-Rob



References