Skip to content

Commit 5488f88

Browse files
committed
optimized GetItem
1 parent 3fb8327 commit 5488f88

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Source/Base/Collections/Spring.Collections.Lists.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,11 @@ function TAbstractArrayList<T>.GetEnumerator: IEnumerator<T>;
529529

530530
function TAbstractArrayList<T>.GetItem(index: Integer): T;
531531
var
532-
listCount: Integer;
532+
items: Pointer;
533533
begin
534-
listCount := Count;
535-
if Cardinal(index) < Cardinal(listCount) then
536-
Exit(fItems[index]);
534+
items := fItems;
535+
if Cardinal(index) < Cardinal(Count) then
536+
Exit(TArray<T>(items)[index]);
537537
RaiseHelper.ArgumentOutOfRange_Index;
538538
{$IFDEF DELPHIXE7_UP}{$IFDEF CPUX86}{$IFDEF OPTIMIZATION_ON}
539539
// cause the compiler to omit push instruction for types that return in eax

0 commit comments

Comments
 (0)