Reputation: 16121
I'm developing on Google App Engine. I am using WingIDE (a python IDE) to debug on the development server. I have several thousand entities in my datastore and I can see that when the development server starts up, it has to go through DatastoreFileStub.Read() and do something which each entity.
The problem is, when I run the development server through WingIDE it runs horrendously slow. I put some profiling logging code into the google app engine to take a peak.
When I run the development server on the command line, I get the following message:
Finished reading 10374 Entites in 10.17 seconds, 1019 per second
When I run the development server through WingIDE however, I get this:
Finished reading 10374 Entites in 52.44 seconds, 197 per second
Anyone have an idea why WingIDE would be 5 times slower?
Upvotes: 1
Views: 725
Reputation: 906
One idea is to use wingdbstub to start debugging after startup is done. You need to add an 'import wingdbstub' to code somewhere, but that could anywhere called after startup. Of course the module has to be on the python path, the IDE has to be configured to listen for connections, and you need to set up some basic security -- which is all described in detail at http://wingware.com/doc/debug/importing-the-debugger
There is also an API so you could start debugging earlier and temporarily turn it off in places where the debugger overhead is too much. See http://wingware.com/doc/debug/debugger-api
Debugger overhead is a tricky thing (at least for CPython) since it's proportional to number of Python byte codes executed. It's not always obvious from looking at Python code how much time is in the interpreter running byte codes and how much time is in C/C++ libraries or Python internals. Something like nested Python loops that iterate over large amounts of data will end up being much slower in a debugger if the work they perform is mostly done in Python. In many things most of the work is actually done in Python internals or library code so the debugger won't slow things down as much.
Upvotes: 0
Reputation: 101139
Probably because you've got a debugger hooked up - debuggers slow code down a lot by instrumenting everything, and deserializing your datastore is a lot of work.
Using the --use_sqlite flag will enable an experimental sqlite-based local datastore, which should require less startup time. Note that it'll require you to wipe your datastore when you switch to it, however.
Upvotes: 2