Skip to content

Commit ccfe31c

Browse files
committed
fix: Using the correct stream to write to file
1 parent 220f634 commit ccfe31c

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 1BRC project specific
22
/bin
33
/data/measurements*.txt
4+
/profiling
45

56
# Compiled l10n files: .mo should be ignored
67
*.mo

Diff for: generator/Common/generate.common.pas

+7-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ constructor TGenerator.Create(
5858
FLineCount:= ALineCount;
5959

6060
FStationNames:= TStringList.Create;
61+
FStationNames.Capacity:= 50000;
62+
//FStationNames.CaseSensitive:= False;
63+
FStationNames.UseLocale:= False;
6164
FStationNames.Duplicates:= dupIgnore;
6265
FStationNames.Sorted:= True;
6366
end;
@@ -75,7 +78,7 @@ procedure TGenerator.BuildStationNames;
7578
entry: String;
7679
count: Int64 = 0;
7780
begin
78-
//WriteLn('Reading "',FInputFile,'"');
81+
WriteLn('Building Weather Stations...');
7982
// Load the Weather Station names
8083
if FileExists(FInputFile) then
8184
begin
@@ -105,6 +108,8 @@ procedure TGenerator.BuildStationNames;
105108
begin
106109
raise Exception.Create(Format('File "%s" not found.', [ FInputFile ]));
107110
end;
111+
WriteLn('Done.');
112+
WriteLn;
108113
end;
109114

110115
function TGenerator.GenerateProgressBar(APosition, AMax, ALength: Int64
@@ -155,7 +160,7 @@ procedure TGenerator.Generate;
155160
FormatFloat('#0.0', randomTemp)
156161
]);
157162
//Write(line);
158-
outputFileStream.WriteBuffer(line[1], Length(line));
163+
outputBufWriter.WriteBuffer(line[1], Length(line));
159164
Dec(progressBatch);
160165
if progressBatch = 0 then
161166
begin

Diff for: generator/Lazarus/src/generator.lpi

+20-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<UseAppBundle Value="False"/>
1515
<ResourceType Value="res"/>
1616
</General>
17-
<BuildModes Count="3">
17+
<BuildModes Count="4">
1818
<Item1 Name="Default" Default="True"/>
1919
<Item2 Name="Debug">
2020
<CompilerOptions>
@@ -77,6 +77,25 @@
7777
</Linking>
7878
</CompilerOptions>
7979
</Item3>
80+
<Item4 Name="Valgrind">
81+
<CompilerOptions>
82+
<Version Value="11"/>
83+
<Target>
84+
<Filename Value="../../../bin/generator"/>
85+
</Target>
86+
<SearchPaths>
87+
<IncludeFiles Value="$(ProjOutDir);../../Common"/>
88+
<OtherUnitFiles Value="../../Common"/>
89+
<UnitOutputDirectory Value="../../../bin/lib/$(TargetCPU)-$(TargetOS)"/>
90+
</SearchPaths>
91+
<Linking>
92+
<Debugging>
93+
<DebugInfoType Value="dsDwarf3"/>
94+
<UseValgrind Value="True"/>
95+
</Debugging>
96+
</Linking>
97+
</CompilerOptions>
98+
</Item4>
8099
</BuildModes>
81100
<PublishOptions>
82101
<Version Value="2"/>

0 commit comments

Comments
 (0)