MOTOBIT.COM - ASP upload, IIS utility Multi Dictionary, Scripting Dictionary and ASP application Dictionary - Performance comparison Article

Member of  Multi | Changes | Purchase | Download

Multi Dictionary, Scripting Dictionary and ASP application Dictionary - Performance comparison

Multi dictionary is designed also as a hi-speed dictionary working with large number of keys . This article provides test comparison between the Multi Dictionary and the two base object used in ASP - ASP global application object and Scripting.Dictionary.

Description of the test

TestRndAdd - Add the number of random keys to the dictionary

  For I = 1 To Cycles
    D(key) = I
  Next

TestRndRead - Read the number of items of random keys from the dictionary

  For I = 1 To Cycles
    X = D(key)  
  Next

TestRndLock - Safe counter over several threads. Change dictionary value with locking. (Has no meaning for Scripting.Dictionary, which is single threaded)

  For I = 1 To Cycles
    D.Lock 
    D(Key) = D(Key) + 1
    D.Unlock
  Next

TestRndRemove - Remove all items from the dictionary with random keys

  For Each i In D 
    D.Remove I
  Next

TestRndExists - Exists of the key in dictionary (ASP application object does not have Exists method)

  For I = 1 To Cycles
    X = D.Exists(key)
  Next

Tested objects

Scripting.Dictionary - the default dictionary object created by MS for VBScript/JScript work. Single threaded dictionary.

  Set D = CreateObject("Scripting.Dictionary")

ASP application Dictionary - ASP object designed to share variables among all requests of a given ASP application. Free threaded object.

  Set D = Application.Contents

Multi Dictionary - Dictionary object with extended functionality designed to share variables among all threads of one process, between processes or computers. Free threaded object.

  Set D = CreateObject("Multi.Dictionary")

Results

For small number of keys and items Multi.Dictionary has the same performace as Application dictionary from ASP and Scripting Dictionary

For large number of keys, the performance of Multi.Dictionary has many times better than ASP Application object and better than Scripting.Dictionary.

Dictionary tests - 100000 keys

Operation Scripting
Dictionary
ASP Application
Dictionary
Multi
Dictionary
Multi - Better
than Scripting
Multi - Better
than ASP app
TestRndAdd 2 564,31ms 141 514,61ms 836,39ms 3,07x 169,20x
TestRndRead 8 838,35ms 166 922,63ms 799,67ms 11,05x 208,74x
TestRndLock - 207 049,42ms 2 042,11ms - 101,39x
TestRndRemove 2 798,35ms 63 733,91ms 1 126,47ms 2,48x 56,58x
TestRndExists 5 806,87ms - 963,69ms 6,03x -

Dictionary tests - 10000 keys

Operation Scripting
Dictionary
ASP Application
Dictionary
Multi
Dictionary
Multi - Better
than Scripting
Multi - Better
than ASP app
TestRndAdd 75,09ms 561,01ms 92,18ms 0,81x 6,09x
TestRndRead 97,06ms 1 136,60ms 68,47ms 1,42x 16,60x
TestRndLock - 934,13ms 164,90ms - 5,66x
TestRndRemove 66,50ms 547,91ms 102,90ms 0,65x 5,32x
TestRndExists 85,54ms - 83,12ms 1,03x -

Dictionary tests - 1000 keys

Operation Scripting
Dictionary
ASP Application
Dictionary
Multi
Dictionary
Multi - Better
than Scripting
Multi - Better
than ASP app
TestRndAdd 41,30ms 42,18ms 39,13ms 1,06x 1,08x
TestRndRead 40,88ms 42,06ms 39,65ms 1,03x 1,06x
TestRndLock - 47,08ms 46,87ms - 1,00x
TestRndRemove 37,42ms 41,65ms 40,71ms 0,92x 1,02x
TestRndExists 38,62ms - 39,17ms 0,99x -

Other links for Multi Dictionary, Scripting Dictionary and ASP application Dictionary - Performance comparison article

Multi

Free-threaded (multithreaded) dictionary object. Lets you work with unique/non-unique keys in VBScript and JScript envinronment (share application/session variables in ASP) or any other programming language. You can share dictionary variables between processes or computers, you can save or restore dictionary variables to a disk, work with keys using regular expression and more.

© 1996 - 2009 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz


Other Motobit links:   IISTracer, real-time IIS monitor   ASP file upload - upload files to ASP. 
ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object