How about your model? What 'shape' is it? Do you have any string
properties that don't need to be indexed?
It does seem quite odd that a simple put like that is getting a
warning though. It basically makes an app useless if that is a proper
recording.
On Oct 2, 2:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I'm trying to build a system where a shopkeeper can list promotional
> items and mark their store on a map, so that anyone searching for
> those items can find a place nearby that has a deal on them. The idea
> is that a shopkeeper has just one store/identity, but they may have
> multiple items, which I want searchable, so I'm using implicit
> references, as it seems like a good way to go.
>
> Here's my code for saving the sale. Ignore all the long/lat stuff;
> that's a different conversation:
>
> class SaveSale(webapp.RequestHandler):
> def get(self):
>
> address = cgi.escape(self.request.get('address'))
> lattitude,longitude =
> cgi.escape(self.request.get('point')).split(',')
> wholeLat,decLat = lattitude.split('.')
> mLat = wholeLat + decLat[0]
> wholeLong,decLong = longitude.split('.')
> mLon = wholeLong + decLong[0]
>
> token = str(mLon)+','+str(mLat)
>
> sale = SaleLocation(longitude = longitude,
> lattitude = lattitude,
> address = address,
> region = token).put()
> SaleItem(salelocation = sale,
> name = 'itemName').put() # hard-coded for now, just for
> testing purposes
>
> self.response.headers['Content-Type'] = 'text/xml'
> self.response.out.write('<response><note>Sale Saved</note></
> response>')
>
> If I take out that "SaleItem(...).put()" command, I get a very
> reasonable average CPU reading of something like 300-400. With it in,
> this save action immediately gets a CPU warning with values ranging
> from 800 to well over 1000.
>
> Gets are a lot lighter, so I'm not worried about the overall volume,
> but I'm concerned that something that is ostensibly supported in the
> documentation can't be done without a CPU warning. That warning says
> the code should be optimized, but there's just not that much there to
> optimize.
> I realize that I could put this value in an array within the
> SaleLocation object, or even in a comma delimited string in the
> SaleLocation object, but that defeats the fairly elegant purpose of
> the implicit link between these objects.
>
> Is there a way to do things this way and reduce the CPU impact, or am
> I screwed? Alternately, is the CPU meter screwed, in which case,
> should I plunder forward, assuming it'll be fixed?
>
> Best,
>
> Ben
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---