Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 7th, 2003, 08:11 PM
Registered User
 
Join Date: Jun 2003
Location: , Hong Kong, Hong Kong.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Making a template , Which one is better?

I have four way:

1. Use files to store the template,every times when i use, i need to read the files, but the speed may be very slow.

2. Use ONE file to store whole template,every times when i use, i need to read it. I am afraid it will increase the usage of the server because the file may be very big.

3. Use file first,then read them and store in the database at first ,when it is necessary , we can update the database 's data, every times when we need , we can read from the database , but i am afraid it will increase the usage of the mysql server when it is many people.

4. All the things store in the database , but it is not easy to edit the template.
Reply With Quote
  #2 (permalink)  
Old July 8th, 2003, 11:45 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What do you mean by template?

If you have ANY data that needs to be read, then it will be read. Whether you store this data in several small files, one big file, in a database, etc., you're still going to read the data.


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #3 (permalink)  
Old July 8th, 2003, 12:03 PM
Registered User
 
Join Date: Jun 2003
Location: , Hong Kong, Hong Kong.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

But which one has a higher efficiency in speed?
Thanks for your answer~:D
Reply With Quote
  #4 (permalink)  
Old July 8th, 2003, 12:31 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, that all depends on your setup. The easiest way to tell what's the fastest is to test it yourself.

Write four PHP scripts where the only difference is where your template files get read. Time the scripts. Run each test at least 50-100 times to get an average reading. Compare the results.

See http://www.php.net/microtime for a useful function in writing timed scripts.

If you're running your database on the same machine as your webserver, I doubt you'll see much of a difference either way. As soon as you put your database on a different machine, things get a little slower because you have to add a network connection to the mix. It's not terribly noticeable as long as your database server is in the same physical network as your webserver. Also, having your database on it's own server means that it can fully utilize the memory in that machine to cache query results, so running a bunch of similar queries should be really fast.

It all boils down to this: there are too many variables to just say "this is the fastest way to do things."


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #5 (permalink)  
Old July 8th, 2003, 10:43 PM
Registered User
 
Join Date: Jun 2003
Location: , Hong Kong, Hong Kong.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks yoru answer
I wil try it~:D
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Making Charts. chobo2 C# 2005 20 March 8th, 2008 05:45 PM
Basic- Making a template call / Date Arithmetic presack XSLT 2 August 3rd, 2007 01:33 PM
Making the connection... B14speedfreak Java Databases 2 November 12th, 2006 01:49 PM
calling one template in other template VijayKumar XSLT 3 September 15th, 2005 11:12 AM



All times are GMT -4. The time now is 11:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.