\'Benchmarks done on:
\'Intel Core i7 2600K @3.41Ghz
\'8GB DDR3 @1333Mhz
\'This benchmark\'s scenario is if you know exactly the number of bits needed.
\'The BitArray is initialized with the fixed length of 10,000,000.
\'The for loop then iterates through each index and sets the bit to true (from false)
Module BitArray_Setting_Benchmark
Sub Main()
Dim array As New BitArray(10000000)
Dim sw As New Stopwatch
sw.Start()
For i = 0 To 9999999
array(i) = 1
Next
sw.Stop()
Console.WriteLine(sw.ElapsedMilliseconds)
Console.ReadKey()
End Sub
End Module
\'BitArray setting 10,000,000 bits in: ~65ms
\'=====================================================================================
\'=====================================================================================
\'This benchmark\'s scenario is if you know exactly the number of bits to start with.
\'The BitList is initialized with the fixed length of 10,000,000.
\'The for loop then iterates through each index and sets the bit to true (from false)
Module BitList_Setting_Benchmark
Sub Main()
Dim list As New BitList(100000000)
Dim sw As New Stopwatch
sw.Start()
For i = 0 To 9999999
list(i) = 1
Next
sw.Stop()
Console.WriteLine(sw.ElapsedMilliseconds)
Console.ReadKey()
End Sub
End Module
\'BitList setting 10,000,000 bits in: ~787ms
\'=====================================================================================
\'=====================================================================================
\'This benchmark\'s scenario is if you don\'t know the initial size of the number of bits.
\'The BitArray is initialized with the fixed length of 0.
\'On each loop the BitArray Length property is set to 1 more then it already is (to accommodate the new bit),
\'A true bit(1) is then set at the index 1 less then the length of the BitArray (stores it at the end).
Module BitArray_Adding_Benchmark
Sub Main()
Dim array As New BitArray(0)
Dim sw As New Stopwatch
sw.Start()
For i = 0 To 9999999
array.Length += 1
array(i) = 1
Next
sw.Stop()
Console.WriteLine(sw.ElapsedMilliseconds)
Console.ReadKey()
End Sub
End Module
\'BitArray completed adding 10,000,000 bits in: ~47,680ms
\'=====================================================================================
\'=====================================================================================
\'This benchmark\'s scenario is if you don\'t know the initial size of the number of bits.
\'The BitList is initialized with no parameters.
\'On each loop a true bit(1) is added to the end of the BitList
Module BitList_Adding_Benchmark
Sub Main()
Dim list As New BitList
Dim sw As New Stopwatch
sw.Start()
For i = 0 To 9999999
list.Add(1)
Next
sw.Stop()
Console.WriteLine(sw.ElapsedMilliseconds)
Console.ReadKey()
End Sub
End Module
\'BitList completed adding 10,000,000 bits in: ~97ms