By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,921 Members | 1,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,921 IT Pros & Developers. It's quick & easy.

ASP Dictionary Object

P: n/a
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
Jul 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.
Jul 21 '05 #2

P: n/a
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" <GT**********@spammotel.com> wrote in message
news:Od**************@TK2MSFTNGP15.phx.gbl...
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.

Jul 21 '05 #3

P: n/a
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.
Jul 21 '05 #4

P: n/a
> 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.
Jul 21 '05 #5

P: n/a
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=di...sp.*&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
Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.