File tree Expand file tree Collapse file tree 4 files changed +43
-5
lines changed
Expand file tree Collapse file tree 4 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 1515 <UseAppBundle Value =" False" />
1616 <ResourceType Value =" res" />
1717 </General >
18- <BuildModes Count =" 3 " >
18+ <BuildModes Count =" 4 " >
1919 <Item1 Name =" Default" Default =" True" />
2020 <Item2 Name =" Debug" >
2121 <CompilerOptions >
8484 </Other >
8585 </CompilerOptions >
8686 </Item3 >
87+ <Item4 Name =" Valgrind" >
88+ <CompilerOptions >
89+ <Version Value =" 11" />
90+ <PathDelim Value =" \" />
91+ <Target >
92+ <Filename Value =" ..\..\..\bin\ghatem" />
93+ </Target >
94+ <SearchPaths >
95+ <IncludeFiles Value =" $(ProjOutDir)" />
96+ <UnitOutputDirectory Value =" ..\..\..\bin\lib\$(TargetCPU)-$(TargetOS)" />
97+ </SearchPaths >
98+ <Linking >
99+ <Debugging >
100+ <DebugInfoType Value =" dsDwarf3" />
101+ <TrashVariables Value =" True" />
102+ <UseValgrind Value =" True" />
103+ <UseExternalDbgSyms Value =" True" />
104+ </Debugging >
105+ </Linking >
106+ <Other >
107+ <CustomOptions Value =" -dDEBUG" />
108+ </Other >
109+ </CompilerOptions >
110+ </Item4 >
87111 </BuildModes >
88112 <PublishOptions >
89113 <Version Value =" 2" />
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ TOneBRCApp = class(TCustomApplication)
1818 private
1919 FFileName: string;
2020 FThreadCount: Integer;
21+ FDictSize: Integer;
2122 procedure RunOneBRC ;
2223 protected
2324 procedure DoRun ; override;
@@ -33,7 +34,7 @@ procedure TOneBRCApp.RunOneBRC;
3334var
3435 vOneBRC: TOneBRC;
3536begin
36- vOneBRC := TOneBRC.Create (FThreadCount);
37+ vOneBRC := TOneBRC.Create (FThreadCount, FDictSize );
3738 try
3839 try
3940 vOneBRC.mORMotMMF(FFileName);
@@ -88,15 +89,17 @@ procedure TOneBRCApp.DoRun;
8889 ErrorMsg: String;
8990begin
9091 // quick check parameters
91- ErrorMsg:= CheckOptions(Format(' %s%s%s%s:' ,[
92+ ErrorMsg:= CheckOptions(Format(' %s%s%s%s%s :' ,[
9293 cShortOptHelp,
9394 cShortOptThread,
95+ cShortOptDictSize,
9496 cShortOptVersion,
9597 cShortOptInput
9698 ]),
9799 [
98100 cLongOptHelp,
99101 cLongOptThread+' :' ,
102+ cLongOptDictSize+' :' ,
100103 cLongOptVersion,
101104 cLongOptInput+' :'
102105 ]
@@ -126,6 +129,11 @@ procedure TOneBRCApp.DoRun;
126129 FThreadCount := StrToInt (GetOptionValue(cShortOptThread, cLongOptThread));
127130 end ;
128131
132+ FDictSize := 45003 ;
133+ if HasOption(cShortOptDictSize, cLongOptDictSize) then begin
134+ FDictSize := StrToInt (GetOptionValue(cShortOptDictSize, cLongOptDictSize));
135+ end ;
136+
129137 if HasOption(cShortOptInput, cLongOptInput) then begin
130138 FFileName := GetOptionValue(
131139 cShortOptInput,
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ interface
2121 cLongOptInput = ' input-file' ;
2222 cShortOptThread: Char = ' t' ;
2323 cLongOptThread = ' threads' ;
24+ cShortOptDictSize: Char = ' s' ;
25+ cLongOptDictSize = ' size' ;
2426 { $ELSE}
2527 cOptionHelp: array of string = [' -h' , ' --help' ];
2628 cOptionVersion: array of string = [' -v' , ' --version' ];
Original file line number Diff line number Diff line change @@ -10,8 +10,10 @@ interface
1010
1111function RoundExDouble (const ATemp: Double): Double; inline;
1212
13+ { $WRITEABLECONST ON}
1314const
1415 cDictSize: Integer = 45003 ;
16+ { $WRITEABLECONST OFF}
1517
1618type
1719
@@ -63,7 +65,7 @@ TOneBRC = class
6365 procedure ExtractLineData (const aStart: Int64; const aEnd: Int64; out aLength: ShortInt; out aTemp: SmallInt); inline;
6466
6567 public
66- constructor Create (const aThreadCount: UInt16);
68+ constructor Create (const aThreadCount: UInt16; const aDictSize: Integer );
6769 destructor Destroy; override;
6870 function mORMotMMF (const afilename: string): Boolean;
6971 procedure DispatchThreads ;
@@ -249,9 +251,11 @@ procedure TOneBRC.ExtractLineData(const aStart: Int64; const aEnd: Int64; out aL
249251
250252// ---------------------------------------------------
251253
252- constructor TOneBRC.Create (const aThreadCount: UInt16);
254+ constructor TOneBRC.Create (const aThreadCount: UInt16; const aDictSize: Integer );
253255var I: UInt16;
254256begin
257+ cDictSize := aDictSize;
258+
255259 FThreadCount := aThreadCount;
256260 SetLength (FStationsDicts, aThreadCount);
257261 SetLength (FThreads, aThreadCount);
You can’t perform that action at this time.
0 commit comments