@@ -18,7 +18,7 @@ static void Main()
1818
1919 //TestEntry.Test1();
2020 //TestEntry.Test2();
21- CollectionTests ( ) ;
21+ ListTests ( ) ;
2222
2323 Console . Beep ( ) ;
2424 }
@@ -121,29 +121,31 @@ static void LinkedListTests()
121121 */
122122 }
123123
124- static void CollectionTests ( )
125- {
126- //{
127- // var report = new BenchmarkConsoleReport<Func<ICollection<object>>>(1600000, (c, r, p) => CollectionBenchmark.Results(c, r, p));
128-
129- // report.AddBenchmark("LinkedList",
130- // count => () => new LinkedList<object>());
131- // report.AddBenchmark("HashSet",
132- // count => () => new HashSet<object>());
133- // report.AddBenchmark("List",
134- // count => () => new List<object>());
135- // report.Pretest(200, 200); // Run once through first to scramble/warm-up initial conditions.
136-
137- // report.Test(100);
138- // report.Test(250);
139- // report.Test(1000);
140- //}
124+ //{
125+ // var report = new BenchmarkConsoleReport<Func<ICollection<object>>>(1600000, (c, r, p) => CollectionBenchmark.Results(c, r, p));
126+
127+ // report.AddBenchmark("LinkedList",
128+ // count => () => new LinkedList<object>());
129+ // report.AddBenchmark("HashSet",
130+ // count => () => new HashSet<object>());
131+ // report.AddBenchmark("List",
132+ // count => () => new List<object>());
133+ // report.Pretest(200, 200); // Run once through first to scramble/warm-up initial conditions.
134+
135+ // report.Test(100);
136+ // report.Test(250);
137+ // report.Test(1000);
138+ //}
141139
140+ static void ListTests ( )
141+ {
142142 Console . WriteLine ( "::: Synchronized Lists :::\n " ) ;
143143 {
144144 var report = new BenchmarkConsoleReport < Func < IList < object > > > ( 100000 , ListParallelBenchmark . Results ) ;
145145
146- report . AddBenchmark ( "LockSynchronizedList" ,
146+ report . AddBenchmark ( "TrackedList" ,
147+ _ => ( ) => new TrackedList < object > ( ) ) ;
148+ report . AddBenchmark ( "LockSynchronizedList" ,
147149 _ => ( ) => new LockSynchronizedList < object > ( ) ) ;
148150 report . AddBenchmark ( "ReadWriteSynchronizedList" ,
149151 _ => ( ) => new ReadWriteSynchronizedList < object > ( ) ) ;
@@ -154,26 +156,30 @@ static void CollectionTests()
154156 report . Test ( 250 , 4 ) ;
155157 report . Test ( 1000 , 4 ) ;
156158 report . Test ( 2000 , 4 ) ;
157- }
159+ report . Test ( 4000 , 4 ) ;
160+ }
161+ }
158162
159- Console . WriteLine ( "::: Synchronized HashSets :::\n " ) ;
160- {
161- var report = new BenchmarkConsoleReport < Func < ICollection < object > > > ( 100000 , CollectionParallelBenchmark . Results ) ;
163+ static void HashSetTests ( )
164+ {
165+ Console . WriteLine ( "::: Synchronized HashSets :::\n " ) ;
166+ {
167+ var report = new BenchmarkConsoleReport < Func < ICollection < object > > > ( 100000 , CollectionParallelBenchmark . Results ) ;
162168
163- report . AddBenchmark ( "ConcurrentDictionary" ,
164- _ => ( ) => new ConcurrentHashSet < object > ( ) ) ;
169+ report . AddBenchmark ( "ConcurrentDictionary" ,
170+ _ => ( ) => new ConcurrentHashSet < object > ( ) ) ;
165171
166- report . AddBenchmark ( "LockSynchronizedHashSet" ,
167- _ => ( ) => new LockSynchronizedHashSet < object > ( ) ) ;
168- report . AddBenchmark ( "ReadWriteSynchronizedHashSet" ,
169- _ => ( ) => new ReadWriteSynchronizedHashSet < object > ( ) ) ;
172+ report . AddBenchmark ( "LockSynchronizedHashSet" ,
173+ _ => ( ) => new LockSynchronizedHashSet < object > ( ) ) ;
174+ report . AddBenchmark ( "ReadWriteSynchronizedHashSet" ,
175+ _ => ( ) => new ReadWriteSynchronizedHashSet < object > ( ) ) ;
170176
171- report . Pretest ( 200 , 200 ) ; // Run once through first to scramble/warm-up initial conditions.
177+ report . Pretest ( 200 , 200 ) ; // Run once through first to scramble/warm-up initial conditions.
172178
173- report . Test ( 100 , 4 ) ;
174- report . Test ( 250 , 4 ) ;
175- report . Test ( 1000 , 4 * 4 ) ;
176- report . Test ( 2000 , 8 * 4 ) ;
177- }
178- }
179+ report . Test ( 100 , 4 ) ;
180+ report . Test ( 250 , 4 ) ;
181+ report . Test ( 1000 , 4 * 4 ) ;
182+ report . Test ( 2000 , 8 * 4 ) ;
183+ }
184+ }
179185}
0 commit comments