Hello everyone,

I've been profiling my application lately in order to optimize it and
find the cause of the 'high cpu' warnings I get, and here are my
preliminary findings: ReferenceProperty is (extremely) slow.

To give you a context, the db of my app is like a big hierarchy where
branches can be reattached elsewhere, and I've been using a
ReferenceProperty as the 'parent' node reference for each branch.
(please note that I am not talking about entity groups, I can't use
them in my app).

For testing purposes I was listing a (heavy) branch with 150 entities,
outputing their properties in xml.
Here are the results:

- Test A: 1023442 function calls (964623 primitive calls) in 6.886 CPU
seconds
- Test B: 527314 function calls (497375 primitive calls) in 3.297 CPU
seconds

now, here's the difference between the two tests, these 2 simple lines
(called on each entity, so 150 times):

if self.oParent is None:
   xml += "parent='0' "

I made further test and realize that basically any reference to the
ReferenceProperty 'oParent' doubles the number of function calls (!).

of course I am not talking about accessing the ReferenceProperty's own
properties, I am only interested to see if it's None (and I tried with
both '==' and 'is'), and also getting its id
(self.oParent.key().id()), and doing one or the other gives the same
behavior.

And the most puzzling is that this is always the same 'oParent' 150
times, since I'm listing its children, so I would expect this
ReferenceProperty to be cached already.


Any Google engineer listening? some advice/explaination here would be
greatly appreciated.

Many thanks for your help

Frank

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to