NYCPHP Meetup

NYPHP.org

[nycphp-talk] slow php

Anirudh Zala arzala at gmail.com
Sun Feb 15 22:40:25 EST 2009


On Saturday 14 Feb 2009 2:01:58 am Nicholas Hart wrote:
> I have a php 'cron job' script which is inserting some records.  It uses
> arrays to store 12 field records along with several nested loops in which
> it tests various currency values from a separate 4 field table and sorts
> them to get the lowest one for insert into a new 4 field table record.  It
> has about 640,000 Product records per 4 Customers or apporx. 2.4 million
> records to insert.  It takes several hours+ to complete and I am hoping
> there is a way to speed it up.
>
> So far, I've tried updating instead of inserting records and changing a few
> functions but nothing seems to make much difference.  Am I being
> unreasonable for the size of the files here?  I'm considering using a
> Derived Table in mySQL and will also consider another language such as
> python.  Please let me know if you have any suggestions.  Thanks.
>
> Nicholas Hart

Besides all of these good suggestions, always use "timers" to measure time 
spent behind execution of certain portion of your script to identify what 
part is taking so long.

Thanks

Anirudh Zala



More information about the talk mailing list