Skip to content

Commit d0545a4

Browse files
committed
simplify condition, reduce station count array size
1 parent 33914a4 commit d0545a4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
Baseline.Console;
1212

1313
const
14-
cNumStations = 42000;
15-
cDictSize = 42000 * 4 + 1;
14+
cNumStations = 41343;
15+
cDictSize = 248071; // numstations * 6, next prime number
1616
cThreadCount = 32;
1717

1818
c0ascii: ShortInt = 48;
19-
//c9ascii: ShortInt = 57;
20-
//cNegAscii: ShortInt = 45;
2119

2220
type
2321
//---------------------------------------
@@ -475,9 +473,9 @@ procedure TOneBRC.Merge(aLeft: TThreadCount; aRight: TThreadCount);
475473
vDataL^.Count := vDataL^.Count + vDataR^.Count;
476474
vDataL^.Sum := vDataL^.Sum + vDataR^.Sum;
477475

478-
if (vDataR^.Max > vDataL^.Max) and (vDataR^.Max <> 0) then
476+
if (vDataR^.Max > vDataL^.Max) then
479477
vDataL^.Max := vDataR^.Max;
480-
if (vDataR^.Min < vDataL^.Min) and (vDataR^.Min <> 0) then
478+
if (vDataR^.Min < vDataL^.Min) then
481479
vDataL^.Min := vDataR^.Min;
482480
end;
483481
end;

0 commit comments

Comments
 (0)