[silva-dev] Silva Metadata: support for delegates?

Clemens Klein-Robbenhaar crobbenhaar at web.de
Mon Apr 4 10:52:50 CEST 2005


Hi JW,

[...]
> I'm still not sure whether this merge does not actually defeat the orignal goal
> for the getMetadataValue method: to be as quick as possible. But there might be
> some problem with this method for other reasons anyway. So, let's review the
> current state.

  Oh, I admit I did not take this into account ...

  In case there is no object delegator set up. the extra code boils down to:

         bind_data = annotations and \
                        annotations[MetadataNamespace].get(BindingRunTime)
         if bind_data:
             delegate = bind_data.get(ObjectDelegate)
             if delegate:
                # not reached here

This does:

  a) check if the "annotations" are not None -- here I could be more explicit and
     hence cheaper ... I do not think the "annotations" object could have
     an expensive __nonzero__ method, if it exist, but maybe it does ...

  b) do a key access ("annotations[MetadataNamespace]") on an object of type
     "Annotations" (which is just a PersistentMapping in disguise).

  c) ... and a "get(BindingRunTime)" on the returned Annotations object
     (again a PersistentMapping).

     I guessed this is not so expensive, as there is a similar call a few
     lines below.

  d) finally this does again a non-optimal boolean comparison instead of
     checking for None and then again a get on a PersistentMapping

  Beside of the optimizations in a) and d) now obvious to me after being
pointed to, I am not certain about the performance impact.

  Is there any code to check the performance of that method,
or am I expected to write my own stuff for it? I can try to do, but I am
not sure if I get the point where performance issues kick in.
  Did the performance issue only happend with large sites (e.g. due to ZODB
cache size issues), or can this reproduced with a small test site, too?

Cheers,
Clemens



More information about the silva-dev mailing list