Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP Dictionary Object

Reply
Thread Tools

ASP Dictionary Object

 
 
TWiSTeD ViBE
Guest
Posts: n/a
 
      11-03-2004
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


 
Reply With Quote
 
 
 
 
Dave Anderson
Guest
Posts: n/a
 
      11-03-2004
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.


 
Reply With Quote
 
 
 
 
TWiSTeD ViBE
Guest
Posts: n/a
 
      11-04-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      11-04-2004
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.


 
Reply With Quote
 
TWiSTeD ViBE
Guest
Posts: n/a
 
      11-05-2004
> 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.


 
Reply With Quote
 
Michael D. Kersey
Guest
Posts: n/a
 
      11-05-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance ordered dictionary vs normal dictionary Navkirat Singh Python 6 07-29-2010 10:18 AM
Re: Performance ordered dictionary vs normal dictionary Chris Rebert Python 0 07-29-2010 06:11 AM
creating a dictionary from a dictionary with regex james_027 Python 1 08-22-2007 07:39 AM
[DICTIONARY] - Copy dictionary entries to attributes Ilias Lazaridis Python 6 02-21-2006 11:27 AM
dictionary within dictionary Fox ASP General 5 03-13-2005 05:03 AM



Advertisments