Skip to content

Commit 19aa4b3

Browse files
committed
micro-optimizations
1 parent 496f686 commit 19aa4b3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

entries/ghatem-fpc/src/OneBRC-dirty.lpr

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ procedure TBRCDictionary.InternalFind(const aKey: Cardinal; out aFound: Boolean;
205205
// found match
206206
aIndex := vIdx;
207207
aFound := True;
208-
break;
208+
exit;
209209
end;
210210
if FHashes[vIdx] = 0 then begin
211211
// found empty bucket to use
212212
aIndex := vIdx;
213213
aFound := False;
214-
break;
214+
exit;
215215
end;
216216
end;
217217
end;
@@ -281,8 +281,7 @@ procedure TOneBRC.ExtractLineData(const aStart: Int64; const aEnd: Int64; out aL
281281

282282
if FData[J] <> ';' then begin
283283
Dec (J);
284-
if FData[J] <> ';' then
285-
Dec(J);
284+
Dec (J, Ord (FData[J] <> ';'));
286285
end;
287286
// I is the position of the semi-colon, extract what's before and after it
288287

@@ -382,9 +381,8 @@ procedure TOneBRC.ProcessData (aThreadNb: TThreadCount; aStartIdx: Int64; aEndId
382381
vFound: Boolean;
383382
begin
384383
for I := 0 to cNumStations - 1 do begin
385-
vData := @FDictionary.FThreadData[aThreadNb][I];
386-
vData^.Max := -2000;
387-
vData^.Min := 2000;
384+
FDictionary.FThreadData[aThreadNb][I].Max := -2000;
385+
FDictionary.FThreadData[aThreadNb][I].Min := 2000;
388386
end;
389387

390388
i := aStartIdx;

0 commit comments

Comments
 (0)