- edited description
Performance issue on Clear of OrderedDictionary
Issue #282
resolved
There appears to be a performance issue when clearing an Ordered Dictionary. The steps to confirm are :
Tik := GetTickCount;
DictOrdered := TCollections.CreateOrderedDictionary<string, string>;
for i := 0 to Length(WordArrayShuffled) - 1 do
DictOrdered.Add(WordArraySorted[i], WordArrayShuffled[i]);
Memo1.Lines.Add('Filling Ordered Dictionary: ' + IntToStr(GetTickCount - Tik));
Tik := GetTickCount;
DictOrdered.Clear;
Memo1.Lines.Add('Clearing Ordered Dictionary: ' + IntToStr(GetTickCount - Tik));
The WordArray used to fill the dictionary is 100,000 English words. Filling the ordered dictionary takes 63milliseconds but clearing it takes 41 seconds.
Comments (8)
-
reporter -
repo owner - changed status to open
Looks like it's missing a specific Clear override to clear the keylist first. Currently it will look for all 100000 keys in the keylist and remove them each.
-
reporter Thank you Stefan. I can verify that making that change fixes the issue.
-
repo owner - changed status to resolved
fixed issue
#282→ <<cset 61cee22ef472>>
-
repo owner fixed performance issue in ordered set as well (see issue
#282)→ <<cset 851926b4636e>>
-
repo owner fixed performance issue in ordered set as well (see issue
#282)→ <<cset 61eaddb1449f>>
-
repo owner - changed milestone to 2.0
-
repo owner - changed version to 2.0-alpha.1
- Log in to comment