Does amount of code compiled for a page affect server performace?

C

CB

I have what must be a very common design issue in web programming, probably discussed 2000 times already, but I can never find any mention by searching. In particular

I have a web page with a form, which is posted to the server when the user is finished. The next stop for the user might be a return to a list, or it might be to refresh the form, depending on circumstances. Which of the followng is better programming technique

1) Post the form data to an intermediate script which handles the database update, and then issues a response.redirect to either the list or the original form depending on circumstance

2) Decide on the next stop using javascript on the client side, and post the data directly to that location -- either the script that generates the list, or the script that generates the form. Use an include directive at the top of both scripts to pull in the code that does the database updating (a big subroutine in a separate file). Each script decides whether an update is needed by checking posted data, if any

In the old days, IE used to give an annoying alert with any redirect, killing option (1), but now that seems to have changed. So the main disadvantage of (1) seems to be extra traffic to and from the client and maybe a bit of latency

The main disadvantage to option (2) seems to be that more code needs to be compiled for the list script and the form script, an extra 300 lines, even though an update might be required less than half the time either script runs

As I understand how ASP works, a script and all its include files are compiled the first time the script is hit, and they stay in memory for a while, so they are not recompiled every time. So the cost of extra lines of code would be more to compile the first time, and a bit more memory consumed. But how much? Is the difference trivial, or something to worry about

At one extreme, an ASP-driven website could consist of just one url, one file, which pulls in all the rest of the code with a long set of includes, and decides which code to execute and what to present to the user based on information in the request. At the other extreme, code can be atomized into dozens or hundreds of single-purpose files, and volley the user to the right next page using response.redirect. From a pure server performance standpoint, would either extreme be the best type of application design? Or is the best somewhere in the middle?
 
B

Bullschmidt

<<
...I have a web page with a form, which is posted to the server when the
user is finished. The next stop for the user might be a return to a
list, or it might be to refresh the form, depending on circumstances.
Which of the followng is better programming technique:

1) Post the form data to an intermediate script which handles the
database update, and then issues a response.redirect to either the list
or the original form depending on circumstance.

2) Decide on the next stop using javascript on the client side...
Here's the concept I like to use:

ASP Design Tips - Post Back Page
http://www.bullschmidt.com/devtip-postbackpage.asp

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top