Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 Another Good "Best Practices" Resource
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Deleted
deleted

4116 Posts

Posted - 25 July 2002 :  14:08:08  Show Profile
Worth to read.

http://www.valtara.com/csc123/WhitePaper/ASPBestPractices.htm

I especially found these as good advices (new for me):
quote:

  • The Server Side Variables collection is built dynamically by IIS the 1st time it is referenced on a page. If you can capture value of key server side variables (such as browser type etc) on your page once and then propagate them via another method, you can gain a performance increase.


  • Likewise the MapPath() method is expensive. Consider, capturing the path of the root web in an application variable for re-use on all of your pages. The MapPath() call implicitly causes the Server Variables collection to be built.


  • Use the Len() function to test for empty strings. Much faster.
    Slow:
    If strX <> "" then

    Faster:
    If len(strX) > 0 then


  • When setting an error trap using On Error Resume Next make sure to turn it off as soon as possible with On Error Goto 0
    This is obvious but not very well coded in Snitz v3.3.x


  • If you need to fetch records from multiple queries serially, then use the following technique:

    mySQL = "Select * From A;Select * From B" 'Notice the two queries separated by a semi-colon (;)
    Create your record set... The recordset object will point to the 1st cursor. Then use
    rs.NextRecordset
    This moves to the next cursor. You can not go back to make sure you have done all that you need to with the 1st cursor. This technique is much faster and more resource efficient then using multiple recordsets or the same one serially.
    I'm not sure if I understand this






  • Think Pink
    ==> Start Internationalization Here

    davemaxwell
    Access 2000 Support Moderator

    USA
    3020 Posts

    Posted - 25 July 2002 :  14:33:24  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
    Can't say I agree that the mappath is expensive, but I don't use it anyway since my dbase path is outside the root and won't work. I usually hard code it since I already know the location. That's just me.

    I've been using the len function for a while now for checking values (have to make sure the item has been trimmed first though...)

    Can't say I understand what setting the error goto 0 line will do.

    The multiple query thing doesn't get you anything anyway if you're using getrows (which we are a lot in 3.4). I personally think it's more expensive because it has to build an recordset of recordsets before it returns it. I personally prefer the method Snitz uses.

    Dave Maxwell
    --------------
    Proud to be a "World Class" Knucklehead
    Go to Top of Page

    Doug G
    Support Moderator

    USA
    6493 Posts

    Posted - 25 July 2002 :  18:21:04  Show Profile
    quote:
    Can't say I understand what setting the error goto 0 line will do.

    If you enable trapping errors with On Error Resume Next, the On Error Goto 0 turns trapping off again.


    ======
    Doug G
    ======
    Go to Top of Page

    Deleted
    deleted

    4116 Posts

    Posted - 25 July 2002 :  18:49:45  Show Profile
    quote:

    quote:
    Can't say I understand what setting the error goto 0 line will do.

    If you enable trapping errors with On Error Resume Next, the On Error Goto 0 turns trapping off again.


    ======
    Doug G
    ======



    That's for sure .

    The problem here is that it must be very well organized. The worst way of doing it is to turn error checking off at the beginning of an ASP file and turning it off at the end, turn it on/off in a mysterious place. This also completely disables the programmer's debugging capabilities.

    That was what I meant with my green coded comment. I'm not sure with v3.4, but I'm never satisfied with the way it is in inc_profile.asp related stuff.


    Think Pink
    ==> Start Internationalization Here
    Go to Top of Page

    D3mon
    Senior Member

    United Kingdom
    1685 Posts

    Posted - 03 August 2002 :  06:58:06  Show Profile  Visit D3mon's Homepage
    quote:

    Slower: (one per line)
    Response.Write Name & "<br>"
    Response.Write Street & "<br>"
    Response.Write City & ", " & State & ", " & Zip & "<br>"

    A little faster (de-reference the object) :
    With Response
    .write Name & "<br>"
    .write Street & "<br>"
    .write City & ", " & State & ", " & Zip & "<br>“
    End With

    Faster: (Concatenate strings)
    Dim strHTML
    strHTML = strHTML & Name & "<br>"
    strHTML = strHTML & Street & "<br>"
    strHTML = strHTML & City & ", " & State & ", " & Zip & "<br>“
    Response.Write strHTML

    Faster Still (Use continuation character):
    Response.Write Name & "<br>" & _
    Street & "<br>" & ", " & _
    State & ", " & _
    Zip & "<br>"

    Even Faster (all on one line):
    Response.Write Name & "<br>" & Street & "<br>" & ", " & State & ", " & Zip & "<br>"




    This has re-opened some old arguments here!!

    Go to Top of Page
      Previous Topic Topic Next Topic  
     New Topic  Topic Locked
     Printer Friendly
    Jump To:
    Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
    This page was generated in 0.68 seconds. Powered By: Snitz Forums 2000 Version 3.4.07