Skip to content

Commit 9e405e2

Browse files
authored
Merge pull request #117 from georges-hatem/main
automatic thread-count detection, and minor cleanups
2 parents f0e4d97 + 80d272a commit 9e405e2

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

entries/ghatem-fpc/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Requirements
44
- mORMot2 library
55
- 64-bit compilation
6+
7+
## Usage
8+
- -t flag to specify the thread-count (default reads the thread-count available on the CPU)
69

710
## Hardware + Environment
811
host:

entries/ghatem-fpc/src/OneBRCproj.lpi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<DebugInfoType Value="dsDwarf3"/>
4848
<UseHeaptrc Value="True"/>
4949
<TrashVariables Value="True"/>
50+
<UseValgrind Value="True"/>
5051
<UseExternalDbgSyms Value="True"/>
5152
</Debugging>
5253
</Linking>

entries/ghatem-fpc/src/OneBRCproj.lpr

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{$IFDEF UNIX}
77
cthreads,
88
{$ENDIF}
9-
Classes, SysUtils, CustApp, Lclintf,
9+
Classes, SysUtils, CustApp, Lclintf, UTF8Process,
1010
Baseline.Console,
1111
OneBRC;
1212

@@ -32,8 +32,6 @@ TOneBRCApp = class(TCustomApplication)
3232
procedure TOneBRCApp.RunOneBRC;
3333
var
3434
vOneBRC: TOneBRC;
35-
vStart: Int64;
36-
vTime: Int64;
3735
begin
3836
vOneBRC := TOneBRC.Create (FThreadCount);
3937
try
@@ -123,7 +121,7 @@ procedure TOneBRCApp.DoRun;
123121
Exit;
124122
end;
125123

126-
FThreadCount := 32;
124+
FThreadCount := GetSystemThreadCount;
127125
if HasOption(cShortOptThread, cLongOptThread) then begin
128126
FThreadCount := StrToInt (GetOptionValue(cShortOptThread, cLongOptThread));
129127
end;

entries/ghatem-fpc/src/onebrc.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ TMyDictionary = class
3636
private
3737
FHashes: TKeys;
3838
FData : TValues;
39-
procedure InternalFind(const aKey: Cardinal; out aFound: Boolean; out aIndex: Integer); inline;
39+
procedure InternalFind(const aKey: Cardinal; out aFound: Boolean; out aIndex: Integer);
4040
public
4141
constructor Create;
4242
property Keys: TKeys read FHashes;
@@ -249,7 +249,6 @@ constructor TOneBRC.Create (const aThreadCount: UInt16);
249249

250250
for I := 0 to aThreadCount - 1 do begin
251251
FStationsDicts[I] := TMyDictionary.Create;
252-
//FStationsDicts[I].Capacity := 45000;
253252
end;
254253
end;
255254

0 commit comments

Comments
 (0)