ASP Dictionary Object

Discussion in 'ASP General' started by TWiSTeD ViBE, Nov 3, 2004.

  1. TWiSTeD ViBE

    TWiSTeD ViBE Guest

    Hi,

    While pouring over some code I've discovered a previous developer heavily
    uses the "dictionary" object. Whilst I see some of the advantages of using
    this system It's something I've not used myself so am not sure of the
    limitations.

    We are about to widen the scope of the website it's being used on to a
    WorldWide system - greatly increasing the number of users that will be using
    the website.

    What I'd like to know is are there any performance issues with using this on
    a heavily used site?

    Thanks!

    Rob
    TWiSTeD ViBE, Nov 3, 2004
    #1
    1. Advertising

  2. TWiSTeD ViBE wrote:
    > While pouring over some code I've discovered a previous developer
    > heavily uses the "dictionary" object. Whilst I see some of the
    > advantages of using this system It's something I've not used myself
    > so am not sure of the limitations.
    >
    > We are about to widen the scope of the website it's being used on to a
    > WorldWide system - greatly increasing the number of users that will
    > be using the website.
    >
    > What I'd like to know is are there any performance issues with using
    > this on a heavily used site?


    "Heavy use" is a bit undescriptive.

    I see no reason why heavy use of scripting dictionaries should be a problem,
    provided the usual pitfalls are avoided. Is the dictionary object assigned
    to Application or Session variables? Did the developer release his objects
    properly in each script? *Those* are scalability hurdles, not mere heavy
    use.



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, Nov 3, 2004
    #2
    1. Advertising

  3. TWiSTeD ViBE

    TWiSTeD ViBE Guest

    Hi - thanks for your help...

    "Heavy use" is undescriptive as it's difficult to gage the increase in
    traffic - the site gets around 300,000 page impressions a day - this can
    expect to be at least doubled (possibly tripled +).

    The object is assigned to neither session nor application variables however
    it is used multiple times on each page and doesn't appear to be closed off
    properly (however I didn't think this would make a difference with the
    garbage collector?).

    Does any of this affect your advice?

    Thanks...

    Rob

    "Dave Anderson" <> wrote in message
    news:...
    > TWiSTeD ViBE wrote:
    >> While pouring over some code I've discovered a previous developer
    >> heavily uses the "dictionary" object. Whilst I see some of the
    >> advantages of using this system It's something I've not used myself
    >> so am not sure of the limitations.
    >>
    >> We are about to widen the scope of the website it's being used on to a
    >> WorldWide system - greatly increasing the number of users that will
    >> be using the website.
    >>
    >> What I'd like to know is are there any performance issues with using
    >> this on a heavily used site?

    >
    > "Heavy use" is a bit undescriptive.
    >
    > I see no reason why heavy use of scripting dictionaries should be a
    > problem,
    > provided the usual pitfalls are avoided. Is the dictionary object assigned
    > to Application or Session variables? Did the developer release his objects
    > properly in each script? *Those* are scalability hurdles, not mere heavy
    > use.
    >
    >
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message.
    > Use
    > of this email address implies consent to these terms. Please do not
    > contact
    > me directly or ask me to contact you directly for assistance. If your
    > question is worth asking, it's worth posting.
    >
    >
    TWiSTeD ViBE, Nov 4, 2004
    #3
  4. TWiSTeD ViBE wrote:
    > The object is assigned to neither session nor application variables
    > however it is used multiple times on each page and doesn't appear to
    > be closed off properly (however I didn't think this would make a
    > difference with the garbage collector?).


    In principle, they should be swept up by GC each time the page goes out of
    scope, and I have no direct knowledge of such a problem with scripting
    dictionary objects.

    But it is considered bad practice *not* to void variables assigned with SET
    in VBScript, and there are countless examples of objects that NEVER get
    collected if this step is not followed.

    ASP FAQ answers it best, in my opinion, by asking: "What do you gain by NOT
    closing and destroying objects?"
    http://aspfaq.com/show.asp?id=2435



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, Nov 4, 2004
    #4
  5. TWiSTeD ViBE

    TWiSTeD ViBE Guest

    > But it is considered bad practice *not* to void variables assigned with
    > SET
    > in VBScript, and there are countless examples of objects that NEVER get
    > collected if this step is not followed.
    >


    As previously said this isn't my code - I am well aware that closing objects
    is good practice and always close objects properly myself.

    This doesn't answer my question - I'm simply trying to ascertain the
    scalability of the dictionary object since it's not something I've used
    myself before.

    Thanks for you help.
    TWiSTeD ViBE, Nov 5, 2004
    #5
  6. TWiSTeD ViBE wrote:
    > I'm simply trying to ascertain the
    > scalability of the dictionary object since it's not something I've used
    > myself before.


    Take a look at these newsgroups' archives:
    http://www.google.com/groups?as_q=d...p=microsoft.public.inetserver.asp.*&lr=&hl=en

    Session or Application variables satisfy the need for associative arrays
    in most instances.

    If data is grouped into categories (i.e., "dictionaries") then using a
    prefix to designate a dictionary entry provides much of the Dictionary
    object functionality:

    Value = Session("$DIC$" & strVarName)
    Session("$DIC$" & strVarName) = Value

    instead of the corresponding Dictionary methods:

    Value = Dic.Item( strVarName )
    Dic.Add( strVarName, Value )

    You can extend the above to allow multiple "dictionaries" , hide the
    above functionality in functions or subroutines or make a VBScript class
    with methods similar to the Dictionary object. All are probably
    significantly faster than the Dictionary object.

    Good Luck,
    Michael D. Kersey
    Michael D. Kersey, Nov 5, 2004
    #6
    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. Ilias Lazaridis
    Replies:
    6
    Views:
    434
    Ilias Lazaridis
    Feb 21, 2006
  2. james_027
    Replies:
    1
    Views:
    319
    Marc 'BlackJack' Rintsch
    Aug 22, 2007
  3. Navkirat Singh
    Replies:
    6
    Views:
    3,006
    Navkirat Singh
    Jul 29, 2010
  4. Chris Rebert
    Replies:
    0
    Views:
    517
    Chris Rebert
    Jul 29, 2010
  5. Fox

    dictionary within dictionary

    Fox, Mar 8, 2005, in forum: ASP General
    Replies:
    5
    Views:
    182
    Michael D. Kersey
    Mar 13, 2005
Loading...

Share This Page