C# ArrayList manipulieren

wessome

Grünschnabel
Hallo zusammen,

ich hab eine anwendung geschrieben und ich hab ein klares geschwindigkeitsproblem.

also, ich hab ein HashTable, diese ueberschreitet eine Groesse von mehreren tausen, in diesen ist als Value eine ArrayList gespeichert die String werte enthaelt, die ArrayList nimmt ausmasse von mehreren millionen eintraegen an, wobei ein string eine "pfadangabe" ist, die bei jedem durchlauf neue endwerte erhaelt, das programm laeuft mit kleinen datenaufwand, aber sobald es zu gross wird ist der code, quasi, nicht mehr ausfuehrbar in einer guten zeit!

kann mir jemand einen tip geben wie ich es besser machen koennte oder wie man schneller jedes ArrayList objekt, welches ein string ist, ein neues ende anhaengen kann

ich hab auch statt string eine weitere Arraylist verwendet, hat aber nix gebracht wirklich in bezug auf geschwindigkeit...:S

im folgenden der code :

Anmerkung: MatchMatrix besteht nur aus 0 und 1 , eingetragen in die strings der arraylist werden indices einer datenmenge

private void MatchMatrix2Hash()
{
Hashtable hBestMatch = new Hashtable();

for(int x=0;x<StrSSQ.Length;x++)
{
System.Console.WriteLine(x.ToString());
for(int y=0;y<StrSSQ.Length;y++)
{
if(MatchMatrix[x,y]==1)
{
ArrayList iPath = new ArrayList();
if(hBestMatch.ContainsKey(x) && hBestMatch.ContainsKey(y))
{
iPath = (ArrayList)hBestMatch[y];
string xy = x+","+y+",";
iPath.Add(xy);
ArrayList temp = (ArrayList)hBestMatch[x];
foreach(string strTemp in temp)
{
string sTemp ="";
sTemp += strTemp+y+",";
iPath.Add(sTemp);
}
hBestMatch.Remove(x);
hBestMatch.Remove(y);
hBestMatch.Add(y,iPath);
}
else if(hBestMatch.ContainsKey(y))
{

iPath = (ArrayList)hBestMatch[y];
string xy = x+","+y+",";
iPath.Add(xy);
hBestMatch.Remove(y);
hBestMatch.Add(y,iPath);
}
else if(hBestMatch.ContainsKey(x))
{

ArrayList temp = (ArrayList)hBestMatch[x];
foreach(string strTemp in temp)
{
string sTemp ="";
sTemp += strTemp+y+",";
iPath.Add(sTemp);
}
hBestMatch.Remove(y);
hBestMatch.Add(y,iPath);
}
else
{
if(arrStartIndex.Contains(x))
{
string xy = x+","+y+",";
iPath.Add(xy);
hBestMatch.Add(y,iPath);
}
}
}
}
}
SortMatchHash(hBestMatch);
}
 
Zurück