diff --git a/entries/ikelaiah/README.md b/entries/ikelaiah/README.md index cb0d54d..a67fa55 100644 --- a/entries/ikelaiah/README.md +++ b/entries/ikelaiah/README.md @@ -141,6 +141,10 @@ Iwan Kelaiah * Reduced buffer for `TStreamReader` to `65536 * 2`. This saves approx 5 seconds. * Changed hashmap from `TGHashMapLP` (linear probing) to `TGHashMapQP` (quadratic probing). This saves approx 5 seconds. +* 1.11 + * Revision release - Sequential approach. 3-5 mins on my Inspiron 15 7510 laptop, around 2m55s (no improvement on speed). + * Replaced `LGenerics` with `Generics.Collections` for the time being. + ## License This project is licensed under the MIT License - see the LICENSE.md file for details @@ -166,4 +170,4 @@ Inspiration, code snippets, libraries, etc. 5. Shraddha Agrawal - https://www.bytesizego.com/blog/one-billion-row-challenge-go. - The advice for not storing measurements for each station in a data structure. 6. Arman Hajisafi - https://arman-hs.github.io - - Encouragements and inspirations. + - Encouragements and inspirations. \ No newline at end of file diff --git a/entries/ikelaiah/src/OneBRC.lpi b/entries/ikelaiah/src/OneBRC.lpi index 816a8c5..b285ee4 100644 --- a/entries/ikelaiah/src/OneBRC.lpi +++ b/entries/ikelaiah/src/OneBRC.lpi @@ -26,7 +26,7 @@ - + @@ -69,7 +69,7 @@ - + @@ -100,11 +100,6 @@ - - - - - diff --git a/entries/ikelaiah/src/OneBRC.lpr b/entries/ikelaiah/src/OneBRC.lpr index e22369f..d007b17 100644 --- a/entries/ikelaiah/src/OneBRC.lpr +++ b/entries/ikelaiah/src/OneBRC.lpr @@ -36,7 +36,7 @@ WeatherStation; const - version = '1.5'; + version = '1.11'; type diff --git a/entries/ikelaiah/src/weatherstation.pas b/entries/ikelaiah/src/weatherstation.pas index 659a6c6..c2d7e3b 100644 --- a/entries/ikelaiah/src/weatherstation.pas +++ b/entries/ikelaiah/src/weatherstation.pas @@ -10,7 +10,8 @@ interface , Math , streamex , bufstream - , lgHashMap + //, lgHashMap + , generics.Collections {$IFDEF DEBUG} , Stopwatch {$ENDIF} @@ -35,11 +36,11 @@ TStat = record type // Using this dictionary, now approx 4 mins faster than Generics.Collections.TDictionary - TWeatherDictionaryLG = specialize TGHashMapQP; + TWeatherDictionaryLG = specialize TFastHashMap; type // a type for storing valid lookup temperature - TValidTemperatureDictionary = specialize TGHashMapQP; + TValidTemperatureDictionary = specialize TFastHashMap; type // Create a class to encapsulate the temperature observations of each weather station. @@ -121,10 +122,10 @@ constructor TWeatherStation.Create(const filename: string); // Create a lookup self.lookupStrFloatToIntList := TValidTemperatureDictionary.Create; // Set expected capacity - saves 10 seconds. - self.lookupStrFloatToIntList.EnsureCapacity(44691); + self.lookupStrFloatToIntList.Capacity := 44691; // Create a dictionary weatherDictionary := TWeatherDictionaryLG.Create; - weatherDictionary.EnsureCapacity(44691); + weatherDictionary.Capacity := 44691; // Create a TStringList for sorting weatherStationList := TStringList.Create; end;