Python dünyasında göreceli olarak yeniyim, ama bu çok ileriye doğru görünüyor.Bu Google App Engine kodunu nasıl optimize edebilirim?
class AddLinks(webapp.RequestHandler):
def post(self):
# Hash the textarea input to generate pseudo-unique value
hash = md5.new(self.request.get('links')).hexdigest()
# Seperate the input by line
allLinks = self.request.get('links').splitlines()
# For each line in the input, add to the database
for x in allLinks:
newGroup = LinkGrouping()
newGroup.reference = hash
newGroup.link = x
newGroup.put()
# testing vs live
#baseURL = 'http://localhost:8080'
baseURL = 'http://linkabyss.appspot.com'
# Build template parameters
template_values = {
'all_links': allLinks,
'base_url': baseURL,
'reference': hash,
}
# Output the template
path = os.path.join(os.path.dirname(__file__), 'addLinks.html')
self.response.out.write(template.render(path, template_values))
pano bu CPU bir ton kullandığını bana anlatıyor:
Google bu kod optimize edilmesi gerektiğini bana bağırıyor.
Geliştirmeleri nerede arayayım?
Evet, ListProperties havalı bir özelliğe sahip desteklemez. Eğer LinkGrouping.gql ("WHERE links =: 1", "http://www.google.com") yaparsanız, listedeki 'http://www.google.com' olan tüm grupları döndürür. –