Forum Themes:
Welcome !

 A general question about asp

Author Message
Guest
A general question about asp Wed. Mar 27, '02 4:30 PM (permalink)
0
I ran your demo and found a lot of <%=%> in your code. don' t you think it is going to slow down the script (context switching)?

as far as I know, if you replace them with response.write it will be faster.

what do you think?
 
#1
    Samuel

    • Total Posts : 11786
    • Reward points : 168350
    • Joined: May 23 '01
    • Status: offline
    RE: A general question about asp Wed. Mar 27, '02 4:38 PM (permalink)
    0

    ORIGINAL: Guest

    I ran your demo and found a lot of <%=%> in your code. don' t you think it is going to slow down the script (context switching)?

    as far as I know, if you replace them with response.write it will be faster.


    This is a myth about ASP. ASP actually runs faster with <%=%> because during compilation time asp.dll performs an optimization for the HTML outside of the context with its response.writeblock method. It references those interspersed HTML codes with ordinal, e.g response.writeblock(1) and this makes the HTML code output faster than the response.write method. with response.write asp.dll doesn' t know if the content that is gonna be written is ASP scripts or pure string, and thus slower.

    hope this answer ur question.
     
    #2
      Guest
      RE: A general question about asp Wed. Mar 27, '02 4:58 PM (permalink)
      0
      so you mean the more u use <%=%> the faster the script?

      I don' t quite understand what you meant by the write block method. At least I don' t see anyone mention it.
       
      #3
        Samuel

        • Total Posts : 11786
        • Reward points : 168350
        • Joined: May 23 '01
        • Status: offline
        RE: RE: A general question about asp Wed. Mar 27, '02 7:13 PM (permalink)
        0
        no, it shouldn' t be intepreted like that.

        you should write you code so that you can read easily.
        There is no need to alter you existing code just because you now know <%=%> is faster, or response.write is slower. you should adhere to what you have been doing. keep the code easy to read for yourself, because you won' t notice at all the performance gain or loss converting your code from one to the other format. It might be 0.005 sec faster, but why bother changing you code for that 0.005 sec?

         
        #4
          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9