I've been experimenting with some approaches to various things, and
ran into this variation in performance that's kind of puzzling me.

Here I'm creating and saving an item with 3 properties - two reference
properties, and a list property of keys.

I was just using dummy data initially, and set the list of keys to be
the same key over and over, and then put the item. The total cost for
this was around 800 ms-cpu.

But then, as soon I started using a 'real' list of keys, where the
keys were all different, the cpu cost doubles.

I tried to isolate what was causing the extra cost, and as far as I
can see, it's purely down just to the fact that the list property in
one instance is made up of a list of the same keys, and in the second
instance is made up of a list of different keys.

To illustrate the point I used this code:

itemA = A.all().get() # get one itemA
itemB = B.all().get() # get one itemB
query = B.all().fetch(36) # get 36 itemBs
itemB_keys = [itemB.key() for itemB in query #construct list of itemB
keys

itemC = C(a = itemA, b = itemB) # create itemC, the item we'll be
putting

for key in itemB_keys:
        itemC.itemB_keys.append(key) # add keys to itemC's list of itemB keys

db.put(itemC)

If I just change the for loop to add the same key the same number of
times rather than a different key each time, and leave everything else
*exactly* the same, suddenly the cpu cost halves.

Why would the make-up of the list property have such an impact on
performance? Are list property puts somehow optimised if the list is
made up of the same key or entity over and over, vs different ones?

Thanks for any insight..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to