Skip to content

Commit e30a8cb

Browse files
authored
Merge pull request #75 from corneliusdavid/main
several updates after a week away
2 parents 199a9ef + 62de72c commit e30a8cb

File tree

8 files changed

+1460
-83
lines changed

8 files changed

+1460
-83
lines changed

entries/dcornelius/src/dcornelius.dpr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
program dcornelius;
2-
(* as: OBRC_DCornelius.dpr
2+
(* as: DCornelius.dpr
33
* by: David Cornelius
44
* on: March, 2024
55
* in: Delphi 12 Athens
@@ -30,7 +30,7 @@ begin
3030
Writeln('SYNTAX: ' + ExtractFileName(ParamStr(0)) + ' <filename> <method>');
3131
Writeln(' where <filename> is a text file with weather station data');
3232
Writeln(' and <method> is the algorytm for summarizing the data:');
33-
Writeln(' TSL = read in all data to a TStringList (lots of memory needed)');
33+
Writeln(' TSL = read in all data to a TStringList');
3434
Writeln(' DIC = build a Dictionary, then sort after built');
3535
Writeln(' TBL = load a FireDAC in-memory table - warning: takes several hours!');
3636
Writeln;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Import Condition="Exists('$(BDS)\bin\CodeGear.Deployment.targets')" Project="$(BDS)\bin\CodeGear.Deployment.targets"/>
3+
<ProjectExtensions>
4+
<ProjectFileVersion>12</ProjectFileVersion>
5+
</ProjectExtensions>
6+
<PropertyGroup>
7+
<DeviceId Condition="'$(Platform)'=='Android'"/>
8+
<DeviceId Condition="'$(Platform)'=='Android64'"/>
9+
<DeviceId Condition="'$(Platform)'=='iOSDevice64'"/>
10+
<DeviceId Condition="'$(Platform)'=='iOSSimARM64'"/>
11+
</PropertyGroup>
12+
<ItemGroup Condition="'$(Platform)'=='OSX64'"/>
13+
<ItemGroup Condition="'$(Platform)'=='Win32'">
14+
<DeployFile Include="Win32\Debug\obrc_dcornelius.exe" Condition="'$(Config)'=='Debug'">
15+
<RemoteDir>obrc_dcornelius\</RemoteDir>
16+
<RemoteName>obrc_dcornelius.exe</RemoteName>
17+
<DeployClass>ProjectOutput</DeployClass>
18+
<Operation>0</Operation>
19+
<LocalCommand/>
20+
<RemoteCommand/>
21+
<Overwrite>True</Overwrite>
22+
<Required>True</Required>
23+
</DeployFile>
24+
</ItemGroup>
25+
<ItemGroup Condition="'$(Platform)'=='Android64'"/>
26+
<ItemGroup Condition="'$(Platform)'=='Android'"/>
27+
<ItemGroup Condition="'$(Platform)'=='OSXARM64'"/>
28+
<ItemGroup Condition="'$(Platform)'=='Win64'"/>
29+
<ItemGroup Condition="'$(Platform)'=='iOSDevice64'"/>
30+
<ItemGroup Condition="'$(Platform)'=='iOSSimARM64'"/>
31+
<ItemGroup Condition="'$(Platform)'=='Linux64'">
32+
<DeployFile Include="Linux64\obrc_dcornelius" Condition="'$(Config)'=='Debug'">
33+
<RemoteDir>obrc_dcornelius\</RemoteDir>
34+
<RemoteName>obrc_dcornelius</RemoteName>
35+
<DeployClass>ProjectOutput</DeployClass>
36+
<Operation>1</Operation>
37+
<LocalCommand/>
38+
<RemoteCommand/>
39+
<Overwrite>True</Overwrite>
40+
<Required>True</Required>
41+
</DeployFile>
42+
</ItemGroup>
43+
</Project>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
program obrc_dcornelius;
2+
(* as: OBRC_DCornelius.dpr
3+
* by: David Cornelius
4+
* on: March, 2024
5+
* in: Delphi 12 Athens
6+
* to: submit an entry in the One Billion Row Challenge
7+
*
8+
* Development/Testing was done on a 3.8 GHz Intel i7 desktop computer running Windows 11.
9+
*
10+
* NOTE: Build with 'Debug' configuration for messages, automatic timing, and a pause at the end.
11+
* Build with 'Release' configuration for the official submission.
12+
*)
13+
14+
{$APPTYPE CONSOLE}
15+
16+
{$R *.res}
17+
18+
uses
19+
System.SysUtils, System.Classes,
20+
{$IFDEF DEBUG}
21+
System.Diagnostics,
22+
{$ENDIF }
23+
uChallengeWithDictionary in 'uChallengeWithDictionary.pas',
24+
uChallengeCommon in 'uChallengeCommon.pas',
25+
uChallengeWithStringList in 'uChallengeWithStringList.pas',
26+
udmChallengeWithFireDAC in 'udmChallengeWithFireDAC.pas' {dmChallengeWithFireDAC: TDataModule};
27+
28+
procedure DisplaySyntax;
29+
begin
30+
Writeln('SYNTAX: ' + ExtractFileName(ParamStr(0)) + ' <filename> <method>');
31+
Writeln(' where <filename> is a text file with weather station data');
32+
Writeln(' and <method> is the algorytm for summarizing the data:');
33+
Writeln(' TSL = read in all data to a TStringList (lots of memory needed)');
34+
Writeln(' DIC = build a Dictionary, then sort after built');
35+
Writeln(' TBL = load a FireDAC in-memory table');
36+
Writeln;
37+
Writeln('Press ENTER...');
38+
Readln;
39+
end;
40+
41+
begin
42+
try
43+
if ParamCount <> 2 then
44+
DisplaySyntax
45+
else begin
46+
{$IFDEF DEBUG}
47+
var StopWatch := TStopwatch.StartNew;
48+
{$ENDIF}
49+
ChallengeCommon := TChallengeCommon.Create(ParamStr(1));
50+
try
51+
var Method := ParamStr(2);
52+
if SameText(Method, 'TSL') then
53+
ChallengeWithStringList
54+
else if SameText(Method, 'DIC') then
55+
ChallengeWithDictionary
56+
else if SameText(Method, 'TBL') then
57+
ChallengeWithFireDAC
58+
else
59+
raise EArgumentException.Create('Invalid method');
60+
finally
61+
ChallengeCommon.Free;
62+
end;
63+
{$IFDEF DEBUG}
64+
StopWatch.Stop;
65+
Writeln('Elapsed Time (seconds/milliseconds): ', StopWatch.Elapsed.Seconds, ' / ', StopWatch.ElapsedMilliseconds);
66+
Readln;
67+
{$ENDIF}
68+
end;
69+
except
70+
on E: Exception do
71+
Writeln(E.ClassName, ': ', E.Message);
72+
end;
73+
end.

0 commit comments

Comments
 (0)