So i just wrote something to check it. (See the results below:)
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class LookupPerformanceTest
{
static void Main(string[] args)
{
// ten million
int iterations = 10000000;
string[] array = new string[iterations];
List
Dictionary
int now = Environment.TickCount;
for (int i = 0; i < now =" Environment.TickCount;" i =" 0;" now =" Environment.TickCount;" i =" 0;" now =" Environment.TickCount;" i =" 0;" s =" array[i];" now =" Environment.TickCount;" i =" 0;" s =" list[i];" now =" Environment.TickCount;" i =" 0;" s =" dictionary[i];">
Results (running in Release mode)
Array population took: 94ms
List population took: 141ms
Dictionary population took: 719ms
Array lookup took: 15ms
List lookup took: 32ms
Dictionary lookup took: 593ms
No comments:
Post a Comment