ASP Dictionary Object

T

TWiSTeD ViBE

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
 
D

Dave Anderson

TWiSTeD said:
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.
 
T

TWiSTeD ViBE

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
 
D

Dave Anderson

TWiSTeD said:
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.
 
T

TWiSTeD ViBE

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

Michael D. Kersey

TWiSTeD said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top