![]() |
|
|
How to use HashTables in ASP? |
|
Moderator
![]()
Latest Blog Post:
My Favorite Isaac Asimov Story Posts: 4,068
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.
__________________
HungarianNotation is the last resort of scoundrels. Why not the first resort? That's where it counts! |
|
|
|
| Sponsored Links (We share ad revenue): |
|
|
Re: How to use HashTables in ASP? |
|
Super Moderator
![]() Posts: 10,628
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 |
|
|
|
| Sponsored Links (We share ad revenue): |
| Thread Tools | |
|
|
| Webmaster Resources Marketplace: |
| Software Development Company | Webhosting.UK.com |
| Web Templates | Text Link Brokers | Stock Photos |