Forum Moderators: coopster

Message Too Old, No Replies

Some questions about speed running

         

yoavr

1:18 am on Jan 19, 2010 (gmt 0)

10+ Year Member



1. What is the fastest way to run over a Mysql rows (and get columns of all the rows)?
2. What is the fastest way to run over a array with a lot of keys? (numeric array)

*Note: both the mysql table and the array are very big, and because of that I am searching for the most efficient way.

Thanks.

dreamcatcher

7:25 am on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your database is big you should always use INDEXES to speed up performance.
[dev.mysql.com...]

dc

yoavr

3:14 pm on Jan 19, 2010 (gmt 0)

10+ Year Member



OK, but what I am looking for is the best way to get all the rows (with some loop), but I search the fastest way..

lammert

4:29 pm on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I guess your question is related to [webmasterworld.com...]

Without telling more about the purpose of your script it is difficult to give any answers. PHP is slow by design because of its interpreted nature and object oriented design with garbage collector where new variables are allocated and deallocated on the fly.

If you want real speed you should consider two things:

  1. Only select those rows and columns from your MySQL database which are needed
  2. Think about moving to a compiled environment vs. interpreted

yoavr

10:59 pm on Jan 19, 2010 (gmt 0)

10+ Year Member



Can you give me an example of a compiled environment?

lammert

11:56 pm on Jan 19, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



There are many compiled languages, but for web work C# in the .NET environment is probably the best known. I sometimes use programs written in plain C in an PHP/MySQL environment to boost performance, but it integrates a little bit clumsy with PHP. I only do this if a lot of number crunching has to be done which would take way to long in a PHP script.