Guest

Tom

By: a guest on Apr 15th, 2009  |  syntax: VisualBasic  |  size: 0.69 KB  |  hits: 189  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1.   dim nDic as new Dictionary
  2.   dim i as integer
  3.   dim x as integer
  4.   dim tTimer as int64 = microseconds()
  5.   for i = 1 to 1000000
  6.    
  7.     //Generate a random UUID
  8.     dim pUUID as String
  9.     for x = 1 to 16
  10.       pUUID=pUUID+chr(round(rnd*255)+1)
  11.     next x
  12.    
  13.     //Check if pUUID exists in the dictionary
  14.     if ndic.HasKey(pUUID) = false then
  15.       //If not, add it to the dictionary
  16.       ndic.Value(pUUID)=pUUID
  17.     end if
  18.   next i
  19.   tTimer = microseconds() - tTimer //Stop the clock!
  20.   print "Operation completed in "+str(tTimer / 1000000)+" seconds"
  21.   print str(ndic.count)+" keys in dictionary"
  22.  
  23.   //Keep the window open at the end of the test
  24.   do
  25.     app.DoEvents
  26.   loop