Skip to content

Commit e91fe95

Browse files
committed
Update - Minor edits on comments and debug statements.
1 parent f2fc4f4 commit e91fe95

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

entries/ikelaiah/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,13 @@ Iwan Kelaiah
123123
* Introduced a pointer to the weather record, `PStat = ^TStat`. This saves approx. 30 - 60 seconds.
124124

125125
* 1.7
126-
* Revision release - Sequential approach. 4-6 mins on my Inspiron 15 7510 laptop (a little improvement on speed).
126+
* Revision release - Sequential approach. 4-6 mins on my Inspiron 15 7510 laptop, around 4m50s (a little improvement on speed).
127127
* Converting Float as String to Int was a bit slow, so resorted to a lookup instead. This saves 30-45 seconds.
128-
* Re-arranged `if` statements in two places. This saves 10-15 seconds x 2 = ~ 30 seconds saving.
128+
* Re-arranged `if` statements in two places. This saves 10-15 seconds x 2 = ~ 30 seconds.
129129

130130
* 1.8
131-
* Revision release - Sequential approach. 4-6 mins on my Inspiron 15 7510 laptop (a little improvement on speed).
132-
* Removed double lookup on dictionaries.
131+
* Revision release - Sequential approach. 3-5 mins on my Inspiron 15 7510 laptop, around 3m50s (a little improvement on speed).
132+
* Removed double lookup on dictionaries; removed `.Contains` and used `TryGetValue` instead. This saves approx 60 seconds.
133133

134134
## License
135135

entries/ikelaiah/src/weatherstation.pas

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,17 @@ procedure TWeatherStation.ReadMeasurementsBuf;
391391
Ref: https://www.freepascal.org/docs-html/rtl/classes/tstream.seek.html}
392392
if lineBreakPos < bytesRead then
393393
fileStream.Seek(-(bytesRead - lineBreakPos), soCurrent);
394-
//{$IFDEF DEBUG}
394+
{$IFDEF DEBUG}
395395
// Do something with the chunk here
396396
// Like counting line
397397
for index := 0 to lineBreakPos - 1 do
398398
if buffer[index] = Ord(#10) then
399399
lineCount := lineCount + 1;
400-
//{$ENDIF DEBUG}
400+
{$ENDIF DEBUG}
401401

402402
// Use memory stream & stream reader
403403
memStream.Write(buffer[0], lineBreakPos - 1);
404-
memStream.Position:=0;
404+
memStream.Position := 0;
405405
streamReader := TStreamReader.Create(memStream);
406406
try
407407
while not streamReader.EOF do
@@ -412,16 +412,16 @@ procedure TWeatherStation.ReadMeasurementsBuf;
412412
finally
413413
streamReader.Free;
414414
end;
415-
//{$IFDEF DEBUG}
415+
{$IFDEF DEBUG}
416416
// Display user feedback
417417
WriteLn('Line count: ', IntToStr(lineCount));
418418
WriteLn('Chunk ', chunkIndex, ', Total bytes read:', IntToStr(totalBytesRead));
419-
//{$ENDIF DEBUG}
419+
{$ENDIF DEBUG}
420420

421-
//{$IFDEF DEBUG}
421+
{$IFDEF DEBUG}
422422
// Increase chunk index - a counter
423423
Inc(chunkIndex);
424-
//{$ENDIF DEBUG}
424+
{$ENDIF DEBUG}
425425
end;
426426
finally
427427
memStream.Free;

0 commit comments

Comments
 (0)