document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. \'Benchmarks done on:
  2. \'Intel Core i7 2600K @3.41Ghz
  3. \'8GB DDR3 @1333Mhz
  4.  
  5. \'This benchmark\'s scenario is if you know exactly the number of bits needed.
  6. \'The BitArray is initialized with the fixed length of 10,000,000.
  7. \'The for loop then iterates through each index and sets the bit to true (from false)
  8. Module BitArray_Setting_Benchmark
  9.     Sub Main()
  10.         Dim array As New BitArray(10000000)
  11.         Dim sw As New Stopwatch
  12.         sw.Start()
  13.         For i = 0 To 9999999
  14.             array(i) = 1
  15.         Next
  16.         sw.Stop()
  17.         Console.WriteLine(sw.ElapsedMilliseconds)
  18.         Console.ReadKey()
  19.     End Sub
  20. End Module
  21. \'BitArray setting 10,000,000 bits in: ~65ms
  22.  
  23. \'=====================================================================================
  24. \'=====================================================================================
  25.  
  26. \'This benchmark\'s scenario is if you know exactly the number of bits to start with.
  27. \'The BitList is initialized with the fixed length of 10,000,000.
  28. \'The for loop then iterates through each index and sets the bit to true (from false)
  29. Module BitList_Setting_Benchmark
  30.     Sub Main()
  31.         Dim list As New BitList(100000000)
  32.         Dim sw As New Stopwatch
  33.         sw.Start()
  34.         For i = 0 To 9999999
  35.             list(i) = 1
  36.         Next
  37.         sw.Stop()
  38.         Console.WriteLine(sw.ElapsedMilliseconds)
  39.         Console.ReadKey()
  40.     End Sub
  41. End Module
  42. \'BitList setting 10,000,000 bits in: ~787ms
  43.  
  44. \'=====================================================================================
  45. \'=====================================================================================
  46.  
  47. \'This benchmark\'s scenario is if you don\'t know the initial size of the number of bits.
  48. \'The BitArray is initialized with the fixed length of 0.
  49. \'On each loop the BitArray Length property is set to 1 more then it already is (to accommodate the new bit),
  50. \'A true bit(1) is then set at the index 1 less then the length of the BitArray (stores it at the end).
  51. Module BitArray_Adding_Benchmark
  52.     Sub Main()
  53.         Dim array As New BitArray(0)
  54.         Dim sw As New Stopwatch
  55.         sw.Start()
  56.         For i = 0 To 9999999
  57.             array.Length += 1
  58.             array(i) = 1
  59.         Next
  60.         sw.Stop()
  61.         Console.WriteLine(sw.ElapsedMilliseconds)
  62.         Console.ReadKey()
  63.     End Sub
  64. End Module
  65. \'BitArray completed adding 10,000,000 bits in: ~47,680ms
  66.  
  67. \'=====================================================================================
  68. \'=====================================================================================
  69.  
  70. \'This benchmark\'s scenario is if you don\'t know the initial size of the number of bits.
  71. \'The BitList is initialized with no parameters.
  72. \'On each loop a true bit(1) is added to the end of the BitList
  73. Module BitList_Adding_Benchmark
  74.     Sub Main()
  75.         Dim list As New BitList
  76.         Dim sw As New Stopwatch
  77.         sw.Start()
  78.         For i = 0 To 9999999
  79.             list.Add(1)
  80.         Next
  81.         sw.Stop()
  82.         Console.WriteLine(sw.ElapsedMilliseconds)
  83.         Console.ReadKey()
  84.     End Sub
  85. End Module
  86. \'BitList completed adding 10,000,000 bits in: ~97ms
');