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 8269351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:11:45+00:00 2026-06-08T06:11:45+00:00

I am having some performance problems that have left me baffled. I am using

  • 0

I am having some performance problems that have left me baffled. I am using Django with MySQL. I do the following:

1 . Send data from a webpage using Ajax.

2 . Receive the post data in Views.py and process it via many function calls, inserting data into MySQL. The very first thing that I do is set a Python variable timeStart. The very last thing that I do, before returning a response, is calculate the time to process the data:

processTime = time.clock() - timeStart 

I send a response using render-to-response where the response is processTime.

3 . processTime is displayed on the webpage.

processTime comes to 1.5 seconds, but the total time from sending the data via Ajax to receiving a response is 13 seconds. 11.5 seconds to render a simple page and to send and receive data – that’s a long time. But then it gets weirder. I cut short the views.py function, almost immediately sending back a response. That cuts the processing time down from 1.5 seconds to almost 0. But it also cuts the total time down from 13 seconds to about 2 seconds. That would seem to indicate that it is, in fact, the data processing that is slow. However that does not explain that the calculated processTime only came to 1.5 seconds. I really do set startTime in the first line and calculate processTime in the last line. StartTime is not overwritten.

It’s almost as though there is some kind of clean up process or something associated with finishing up and sending a response, something that is dependent on the function calls. But what? Or I am doing something stupid with my time calculation? I have set debug = False.

EDIT – extra info:

The template only contains the word “hello” and {{result}}. I’m not returning any queryset, just processTime: {‘result’:processTime}

The time difference seems to perhaps come when I am using MySQL stored functions. Like it’s returning the result, but then still doing something????

  • 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-06-08T06:11:48+00:00Added an answer on June 8, 2026 at 6:11 am

    The problem was in the way that I measured processTime. I needed to be using time.time(), not time.clock(). time.clock() told me that I had only spent 1.5 seconds, but that’s apparently just the CPU time, not the actual time. The actual time spent in view.py was more like 13 seconds, which corresponds to what I had measured for the complete transaction.

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

Sidebar

Related Questions

C#, .NET4. We have some performance critical code that is causing some problems. It
I have been happily using VS 2010 for several weeks without any performance problems.
I am having some performance problems with IE 7, whereby the page pauses during
I am having some performance problems with my Delphi 2006 app. Can you Suggest
Having some trouble with R's garbage collection, when passing objects to C++. We have
Currently having some problems- now = datetime.datetime.now() month = now.strftime(%B) site = wikipedia.getSite('en', 'wikiquote')
Basically having some trouble with using Hover to hide or show an item. The
Im having some problems getting the Sticky Footer to work on my site. If
I am having some problems with Phonegap and the Android Camera API. I can
I have a file log that I would like to parse and am having

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.