Skip to content

Commit 2527529

Browse files
authored
Merge branch 'main' into ikelaiah-rev11
2 parents c052a01 + b6b4be6 commit 2527529

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+6875
-995
lines changed

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Grab all your threads, reach out to SIMD, or pull any other trick, and create t
1717
<img src="img/1brc.png" alt="1BRC" style="display: block; margin-left: auto; margin-right: auto; margin-bottom:1em; width: 50%;">
1818
</p>
1919

20-
The text file contains temperature values for a range of weather stations. Each row is one measurement in the format `<string: station name>;<double: measurement>`, with the measurement value having exactly one fractional digit.
20+
The text file contains temperature values for a range of weather stations. Each row is one measurement in the format `<string: station name>;<double: measurement>`, with the measurement value having exactly one fractional digit. Rows are separated by a single line feed equal of LF (ascii 10) for consistency with the original challenge - and not CR+LF (ascii 13+10) any more.
2121
The following shows ten rows as an example:
2222

2323
```
@@ -119,7 +119,7 @@ C:> CertUtil -hashfile .\data\measurements.txt SHA256
119119
Get-FileHash .\data\measurements.txt -Algorithm SHA256
120120
```
121121
Expected `SHA256` hash:
122-
`ebad17b266ee9f5cb3d118531f197e6f68c9ab988abc5cb9506e6257e1a52ce6`
122+
`2b48bc2fa0b82d748925a820f43f75df01cc06df7447c7571e52d3962e675960`
123123

124124
## Verify Output File
125125

@@ -154,18 +154,19 @@ These are the results from running all entries into the challenge on my personal
154154

155155
| # | Result (m:s.ms) | Compiler | Submitter | Notes | Certificates |
156156
|--:|----------------:|---------:|:----------|:------|:-------------|
157-
| 1 | 00:01.718 | lazarus-3.0, fpc-3.2.2 | Arnaud Bouchez | Using `mORMot2`, 32 threads | |
158-
| 2 | 00:02.355 | lazarus-3.0, fpc-3.2.2 | O Coddo | Using `SCL`, 32 threads | |
159-
| 3 | 00:05.998 | lazarus-3.0, fpc-3.2.2 | Georges Hatem - FPC | Free Pascal: Using 32 thread | |
160-
| 4 | 00:09.974 | lazarus-3.0, fpc-3.2.2 | G Klark | Using 32 threads | |
161-
| 5 | 00:15.873 | lazarus-3.0, fpc-3.2.2 | Székely Balázs | Using 32 threads | |
162-
| 6 | 00:53.131 | lazarus-3.0, fpc-3.2.2 | Hartmut Grosser | Using 1 thread | |
163-
| 7 | 01:15.640 | lazarus-3.0, fpc-3.2.2 | Richard Lawson | Using 1 thread | |
164-
| 8 | 02:48.079 | lazarus-3.0, fpc-3.2.2 | Iwan Kelaiah | Using 1 thread | |
165-
| 9 | 06:49.661 | delphi 12.1 | Brian Fire | Using 1 thread | |
166-
| 10 | 06:58.535 | delphi 12.1 | David Cornelius | Using 1 thread | |
167-
| 🟠 | 00:19.699 | lazarus-3.0, fpc-3.2.2 | Lurendrejer Aksen | Using 32 threads **(failed hash)** | |
168-
| 🟠 | 14:36.808 | delphi 12.1 | Daniel Töpfl | Using 1 thread **(failed hash)** | |
157+
| 1 | 0:1.651 | lazarus-3.0, fpc-3.2.2 | Arnaud Bouchez | Using `mORMot2`, 32 threads | |
158+
| 2 | 0:2.606 | lazarus-3.99, fpc-3.3.1 | O Coddo | Using `SCL`, 32 threads | |
159+
| 3 | 0:5.884 | lazarus-3.0, fpc-3.2.2 | Georges Hatem | Free Pascal: Using 32 thread | |
160+
| 4 | 0:9.808 | lazarus-3.99, fpc-3.3.1 | G Klark | Using 32 threads | |
161+
| 5 | 0:15.059 | lazarus-3.0, fpc-3.2.2 | Székely Balázs | Using 32 threads | |
162+
| 6 | 0:53.488 | lazarus-3.0, fpc-3.2.2 | Hartmut Grosser | Using 1 thread | |
163+
| 7 | 1:15.706 | lazarus-3.0, fpc-3.2.2 | Richard Lawson | Using 1 thread | |
164+
| 8 | 2:27.407 | lazarus-3.0, fpc-3.2.2 | Iwan Kelaiah | Using 1 thread | |
165+
| 9 | 6:55.406 | delphi 12.1 | David Cornelius | Using 1 thread | |
166+
| 10 | 7:4.147 | delphi 12.1 | Brian Fire | Using 1 thread | |
167+
| 🟠 | 0:19.460 | lazarus-3.0, fpc-3.2.2 | Lurendrejer Aksen | Using 32 threads **(failed hash)** | |
168+
| 🟠 | 15:4.100 | delphi 12.1 | Daniel Töpfl | Using 1 thread **(failed hash)** | |
169+
169170

170171
> **NOTE**
171172
>

baseline/Common/baseline.delphi.pas

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ interface
55
uses
66
System.Classes
77
, System.Generics.Collections
8+
, System.SysUtils
89
;
910

1011
type
@@ -28,6 +29,7 @@ TBaseline = class
2829
private
2930
FInputFile: String;
3031
FStationNames: TStringList;
32+
FFormatSettings: TFormatSettings;
3133
FHashStationList: TDictionary<string, PWeatherStation>;
3234
procedure AddToHashList (AStation: String; ATemp: TAmount);
3335
procedure BuildHashList;
@@ -43,8 +45,7 @@ TBaseline = class
4345
implementation
4446

4547
uses
46-
System.SysUtils
47-
, System.StrUtils
48+
System.StrUtils
4849
, System.Math
4950
, Baseline.Common
5051
;
@@ -72,6 +73,8 @@ function Compare (AList: TStringList; AIndex1, AIndex2: Integer): Integer;
7273

7374
constructor TBaseline.Create (AInputFile: String);
7475
begin
76+
FFormatSettings := TFormatSettings.Create;
77+
FFormatSettings.DecimalSeparator := '.';
7578
FInputFile := AInputFile;
7679

7780
FHashStationList := TDictionary<string, PWeatherStation>.Create;
@@ -182,7 +185,7 @@ procedure TBaseline.Generate;
182185
Min := weatherStation^.FMin/10;
183186
Max := weatherStation^.FMax/10;
184187
Mean := RoundExDouble(weatherStation^.FTot/weatherStation^.FCnt/10);
185-
strTemp := weatherStation^.FStation + '=' + FormatFloat('0.0', Min) + '/' + FormatFloat('0.0', Mean) + '/' + FormatFloat('0.0', Max) + ',';
188+
strTemp := weatherStation^.FStation + '=' + FormatFloat('0.0', Min, FFormatSettings) + '/' + FormatFloat('0.0', Mean, FFormatSettings) + '/' + FormatFloat('0.0', Max, FFormatSettings) + ',';
186189
FStationNames.Add(strTemp);
187190
end;
188191
FStationNames.EndUpdate;

0 commit comments

Comments
 (0)