Reply
How to use HashTables in ASP?
Old 04-22-2008, 03:35 PM How to use HashTables in ASP?
Learning Newbie's Avatar
Moderator

Latest Blog Post:
My Wish for Webmaster Talk
Posts: 5,179
Name: John Alexander
I keep telling people it's impossible, but no one likes that answer. A customer of ours is still using ASP Classic like it's 1986, and they're paying us to fix the mess. They want us to use ASP so they can understand it, and so it integrates cleanly with the rest of their code, mainly session state. Their app gets a lot of traffic, sounds like hundreds of page requests per second.

There are about 140,000 items cached in a list at the application level. There's a six-byte key, and a struct value we need to look up using that key. Relational databases are too slow to get the data from, so it needs to be stored in memory. This takes about 2 MB of RAM, and there's only one copy in the entire app, so that's not an issue.

In ASP Classic, the way you might do this would be to store the items in an array and then iterate over it, looking for the key, and retrieve the value. This is way too slow. I thought about sorting the array and doing a binary search, but the keys change occasionally, so that's out.

Can you do something like Server.CreateObject("HashTable") or am I stuck writing a .NET class, exposing it to COM+, and then using it through interop? I don't understand the part about prime numbers quite well enough to write my own implementation.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-29-2008, 03:54 PM Re: How to use HashTables in ASP?
chrishirst's Avatar
Super Moderator

Posts: 13,472
Location: Blackpool. UK
A dictionary object would certainly be quicker than an array.
And take a look at Midori's ActiveX objects for one that's somewhat more robust than the MS one and comes with source code ( VB6 mind you )
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to How to use HashTables in ASP?
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11996 seconds with 12 queries