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

Discussion in 'ASP General' started by CB, Feb 23, 2004.

  1. CB

    CB Guest

    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?
    CB, Feb 23, 2004
    #1
    1. Advertising

  2. CB

    Bullschmidt Guest

    <<
    ...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...


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt, Feb 23, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. thisyr4leafs

    ASP.NET Page Performace Problem

    thisyr4leafs, Aug 26, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,086
    John Rivers
    Aug 27, 2005
  2. Stephan Br?nnimann
    Replies:
    2
    Views:
    298
    P.J. Plauger
    Nov 10, 2003
  3. Klaus Schneider
    Replies:
    1
    Views:
    539
    Rolf Magnus
    Dec 2, 2004
  4. John
    Replies:
    16
    Views:
    497
    Mark McIntyre
    Sep 29, 2006
  5. lander
    Replies:
    5
    Views:
    586
    bruce barker
    Mar 5, 2008
Loading...

Share This Page