[Tutor] Weird speed issue with mysql vs php

orbitz orbitz at ezabel.com
Fri Aug 20 01:25:03 CEST 2004


Hello I have a situation where I'm rewriting a bunch of legacy PHP code 
in python. This issue I'm having is my python program takes about 4.5 
hours to write and the PHP equivalent takes about 15 minutes. The 
program performs a bunch of SQL queries on a MySQL query, and then sends 
an email with this data. The longest query is limited to 20 results all 
the time. The odd thing is in my python one it looks like most of the 
work is being done on the mysql end and doesn't use up much CPU, while 
the PHP one looks like it uses up a lot of CPU and much on the mysql 
side. I'm double checking to make sure I didn't put a loop somewhere 
where there should not be or something silly, but does anyone have any 
ideas where my issue could be? I profiled my app and nothing looks *too* 
odd so I'm somewhat stumped as to why the original version is so fast.

Also, I use the StringIO class where ever I'm appending long strings 
together and what not to speed things up.

Any suggestions would be very appreciated, thank you.




More information about the Tutor mailing list