PDA

View Full Version : Number of pages and performance


pankaj
03-31-2003, 06:43 AM
Does the number of pages affect the performance of the website? My friend has a habit of writing a diff page for processing data (adding info to database)

raf
03-31-2003, 11:41 AM
Hmm. I don't think there is a straightforward answer to that. I tend to use a lott of separate pages to do my processing and stuff, but it depends on a specific app and on what sort of actions i'm doing.
Using multipurpose pages is probably the way to go to show, validate and insert the info, because you can display errormessages near the formfields that caused them.
But i don't think that the webserver processes that code faster then if it would be spread over two or more pages. You probably need a little bit more cache if you use seperated pages. Don't know.
For me, seperate pages are faster to code, easier to debug and it results in a more modular code. I often use 1 page in multiple screenflows. For instance, an update page can have more then 1 form that post to it. So i separate the forms and the validation/updating pages and work with hidden fields or the querystring to get the values for the parameters in my sql statement.
The other week, i wrote an admin-module and part of it was updating the prices for 4 entitys (in 4 different tables), for all the instances of that entity, or for all the instances of a categorie of that entity, or just 1 instance. You could do all that in one multipurpose page, but it would get quite long and complicated (since the layout and logic was different for each entity). So i concentrated the update-sql in a seperate page, and had four forms to display all records/prices etc.

But that's just my approach. Some people use a lot of includes etc, but i don't think it makes a lott off difference at runtime.