Forum Moderators: open

Message Too Old, No Replies

What is going to be quicker?

data in an include file or call it from DB

         

stuartmcdonald

8:56 am on May 14, 2006 (gmt 0)

10+ Year Member



Let's say you have a mysql table with the names of all the states in the US. This is information that is never going to change.

I got all the states and coded them into an array in an include file in the following kind of format:

$state[1]=california;
$state[2]=nevada;
$state[3]=arizona;
etc

Then I ran a timed test where I printed the names off a couple of hundred times, then I did the same caling the data from the DB.

Pulling the information from the include file was far far faster than pulling it from the DB.

I'm considering coding the site using this process to display non-changing data rather than calling it from the DB -- I'd just include the dictionary file with any files that needed the info -- are there any issues that would make this an unwise method?

Any pointers much appreciated

txbakers

11:36 pm on May 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think an include file would be much better. If you never have to change the data, then the include would be faster.

philbish

5:38 am on May 19, 2006 (gmt 0)

10+ Year Member



Yea, for sure the include is faster.