Skip to content

Commit 6b54eac

Browse files
committed
2 parents 2c6cd05 + b6277b7 commit 6b54eac

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

entries/ikelaiah/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ Iwan Kelaiah
136136
* Use `ShortString` whenever possible. This saves approx 20 seconds.
137137
* Pre-allocate initial size for dictionaries. saves approx 20 seconds.
138138

139+
* 1.10
140+
* Revision release - Sequential approach. 3-5 mins on my Inspiron 15 7510 laptop, around 2m55s (a little improvement on speed).
141+
* Reduced buffer for `TStreamReader` to `65536 * 2`. This saves approx 5 seconds.
142+
* Changed hashmap from `TGHashMapLP` (linear probing) to `TGHashMapQP` (quadratic probing). This saves approx 5 seconds.
143+
139144
## License
140145

141146
This project is licensed under the MIT License - see the LICENSE.md file for details

entries/ikelaiah/src/weatherstation.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ TStat = record
3535

3636
type
3737
// Using this dictionary, now approx 4 mins faster than Generics.Collections.TDictionary
38-
TWeatherDictionaryLG = specialize TGHashMapLP<ShortString, PStat>;
38+
TWeatherDictionaryLG = specialize TGHashMapQP<ShortString, PStat>;
3939

4040
type
4141
// a type for storing valid lookup temperature
42-
TValidTemperatureDictionary = specialize TGHashMapLP<ShortString, int64>;
42+
TValidTemperatureDictionary = specialize TGHashMapQP<ShortString, int64>;
4343

4444
type
4545
// Create a class to encapsulate the temperature observations of each weather station.
@@ -322,7 +322,7 @@ procedure TWeatherStation.ReadMeasurements;
322322
// Open the file for reading
323323
fileStream := TFileStream.Create(self.fname, fmOpenRead);
324324
try
325-
streamReader := TStreamReader.Create(fileStream, 65536 * 32, False);
325+
streamReader := TStreamReader.Create(fileStream, 65536 * 2, False);
326326
try
327327
// Read and parse chunks of data until EOF -------------------------------
328328
while not streamReader.EOF do

0 commit comments

Comments
 (0)