Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:54:00+00:00 2026-05-25T15:54:00+00:00

Hello I want to know if in the appengine env the things I did

  • 0

Hello I want to know if in the appengine env the things I did is usefull
Because I don’t know why this page is very slow.

class Foo(db.Model):
    id = db.StringProperty(multiline=True)
    name = db.StringProperty(multiline=True)
    date = db.DateTimeProperty(auto_now_add=True)
    description = db.TextProperty()    
    carac = db.StringProperty(multiline=True)



class FoosPage(webapp.RequestHandler):
  def get(self):
    foos =  memcache.get("all-foos")
    if foos is None:
        foos = Foo.all()
        size = foo.count()
    else :
        size = len(foo)

    foosTab=[]
    for i in range(size) :
        foosTab.insert(i,foos[i])
        memcache.set("all-foos", foosTab, 60)
    template_values = {
        'foos': foos
            }
    path = os.path.join(os.path.dirname(__file__) + '/../templates/', 'foos.html')
    self.response.out.write(template.render(path, template_values))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:54:00+00:00Added an answer on May 25, 2026 at 3:54 pm

    You have the memcache.set() inside the loop. That’s a lot of unnecessary traffic to the memcache service. Do it once, after the loop.

    Further, the way you have that coded, there’s no need for establishing size.

    foosTab = []
    for foo in foos:
        foosTab.append(foo)
    

    or, more idiomatically

    foosTab = [foo for foo in foos]
    

    That’ll save you doing a separate count().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know, is this legal? function test() { alert (hello) $(#loading).show(); }
I was following this example: http://developer.android.com/resources/tutorials/views/hello-autocomplete.html And I want to know how I can
hello i have one very NOOB question and i want to know the answer.
hello i am little new to all this but i want to know that:
I want to do the equivalent of the following VB in c# Function([class]) hello
Hello I want to know if it's possible to add widgets to a CRUD
How is the following line interpreted by GCC compiler: printf(HELLO); I want to know
Hello I want print numbers from 30 to -30, this is my code #include
Hello i want to know if i can download my app before making it
hello i am new in android i want know how to iterate child node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.