Skip to content

Commit 131e3c0

Browse files
Merge branch 'main' of github.com:corneliusdavid/1BRC-Delphi into main
2 parents 3efa82e + 6385603 commit 131e3c0

24 files changed

Lines changed: 1703 additions & 161 deletions
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

CONTRIBUTING.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# How to contribute
2+
3+
4+
## Formatting
5+
6+
All entries should be formatted using the `Ctr-D` shortcut for both Lazarus and Delphi entries.
7+
8+
## Folder name for the entry
9+
10+
As mentioned on the `REAME.md` file, the name of the folder for the entry should be composed of your first initial followed by your preferred last name.
11+
12+
For example, using _Gustavo Carreno_ for the name, the folder would be `entries/gcarreno`.
13+
14+
## Name of the executable binary
15+
16+
The executable binary follows the same rules has the entry folder above.
17+
18+
## Placement of the executable binary
19+
20+
The executable binary should be placed under a folder named `bin` below the root folder of this repository.
21+
22+
This folder is not present on the repository and is being ignored from the `.gitignore`.
23+
24+
## Commit Messages
25+
26+
(Originally from the [Udacity Git Commit Message Style Guide](https://udacity.github.io/git-styleguide/index.html))
27+
28+
### Message Structure
29+
30+
A commit messages consists of three distinct parts separated by a blank line: the title, an optional body and an optional footer.
31+
32+
The layout looks like this:
33+
```
34+
type: subject
35+
36+
body
37+
38+
footer
39+
```
40+
41+
The title consists of the type of the message and subject.
42+
43+
### The Type
44+
45+
The type is contained within the title and can be one of these types:
46+
47+
* feat: a new feature
48+
* fix: a bug fix
49+
* docs: changes to documentation
50+
* style: formatting, missing semi colons, etc; no code change
51+
* refactor: refactoring production code
52+
* test: adding tests, refactoring test; no production code change
53+
* chore: updating build tasks, package manager configs, etc; no production code change
54+
55+
### The Subject
56+
57+
Subjects should be no greater than 50 characters, should begin with a capital letter and do not end with a period.
58+
59+
Use an imperative tone to describe what a commit does, rather than what it did. For example, use change; not changed or changes.
60+
The Body
61+
62+
Not all commits are complex enough to warrant a body, therefore it is optional and only used when a commit requires a bit of explanation and context. Use the body to explain the what and why of a commit, not the how.
63+
64+
When writing a body, the blank line between the title and the body is required and you should limit the length of each line to no more than 72 characters.
65+
66+
### The Footer
67+
68+
The footer is optional and is used to reference issue tracker IDs.
69+
70+
### Example Commit Message
71+
72+
```
73+
feat: Summarise changes in around 50 characters or less
74+
75+
More detailed explanatory text, if necessary. Wrap it to about 72
76+
characters or so. In some contexts, the first line is treated as the
77+
subject of the commit and the rest of the text as the body. The
78+
blank line separating the summary from the body is critical (unless
79+
you omit the body entirely); various tools like `log`, `shortlog`
80+
and `rebase` can get confused if you run the two together.
81+
82+
Explain the problem that this commit is solving. Focus on why you
83+
are making this change as opposed to how (the code explains that).
84+
Are there side effects or other non intuitive consequences of this
85+
change? Here's the place to explain them.
86+
87+
Further paragraphs come after blank lines.
88+
89+
- Bullet points are okay, too
90+
91+
- Typically a hyphen or asterisk is used for the bullet, preceded
92+
by a single space, with blank lines in between, but conventions
93+
vary here
94+
95+
If you use an issue tracker, put references to them at the bottom,
96+
like this:
97+
98+
Resolves: #123
99+
See also: #456, #789
100+
```

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ In order to verify the official output, we are providing the [source code](./bas
125125
You can verify the generated `measurements.txt` with a `SHA256` utility:
126126

127127
**Linux**
128-
```bash
128+
```console
129129
$ sha256sum ./data/measurements.txt
130130
```
131+
**Windows (Command Line)**
132+
```console
133+
C:> CertUtil -hashfile .\data\measurements.txt SHA256
134+
```
131135
**Windows (PowerShell)**
132136
```powershell
133137
Get-FileHash .\data\measurements.txt -Algorithm SHA256
@@ -156,6 +160,7 @@ These are the results from running all entries into the challenge on my personal
156160
## Evaluating Results
157161
Each contender is run 10 times in a row for both `SSD` and `HDD` using `hyperfine` for the time taking. \
158162
The mean value of the 10 runs is the result for that contender and will be added to the results table above. \
163+
The min and max values are discarded and the remaining 8 values are then used to calculate the average. \
159164
The exact same `measurements.txt` file is used for evaluating all contenders.
160165

161166
## Prize

baseline/Lazarus/src/baseline.lpi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@
112112
<OtherUnitFiles Value="../../Common"/>
113113
<UnitOutputDirectory Value="../../../bin/lib/$(TargetCPU)-$(TargetOS)"/>
114114
</SearchPaths>
115+
<Linking>
116+
<Debugging>
117+
<DebugInfoType Value="dsDwarf2Set"/>
118+
</Debugging>
119+
</Linking>
115120
</CompilerOptions>
116121
<Debugging>
117122
<Exceptions Count="3">

entries/entries.json.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@
77
"input-hdd": "{...}1brc-ObjectPascal/data/measurements-1_000_000_000.txt",
88
"hyperfine": "hyperfine -w 1 -r 10 -N -n '[[name]]' --export-json '[[results-json]]' '[[entry]]'",
99
"lazbuild": "{...}FreePascal_3.0/lazarus/lazbuild",
10+
"output-hash": "0000000000000000000000000000000000000000000000000000000000000000",
1011
"entries": [
12+
{
13+
"name": "Official Baseline",
14+
"notes": "Beeing the last of all",
15+
"compiler": "fpc",
16+
"entry-folder": "../baseline/Lazarus/src",
17+
"entry-binary": "baseline",
18+
"lpi": "baseline.lpi",
19+
"has-release": true,
20+
"threads": 1,
21+
"run-params": "-i [[input]]"
22+
},
1123
{
1224
"name": "Gustavo Carreno",
1325
"notes": "Using 30 threads",

entries/ikelaiah/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ The approach I implemented here is simplistic.
66

77
- Sequentially read the measurement file.
88
- Populate a `TDictionary` with station names, min, max, count and sum; without storing all the temperature measurements.
9+
- Avoided [StrUtil.SplitString](https://www.freepascal.org/docs-html/rtl/strutils/splitstring.html), used [`Pos()`](https://www.freepascal.org/docs-html/rtl/system/pos.html) and [`Copy()`](https://www.freepascal.org/docs-html/rtl/system/copy.html) instead.
910
- Use a custom comparer to sort the station and temperature statistics in a `TStringList`.
10-
- Display the sorted measurements using a simple for loop.
11+
- Use the rounding method as provided in the `baseline.lpr` (or the `README.md` from 1brc-ObjectPascal).
12+
- Display the sorted measurements using a simple `for` loop.
1113

1214
## Getting Started
1315

@@ -17,7 +19,7 @@ The approach I implemented here is simplistic.
1719

1820
### Compiling
1921

20-
* Open `OneBRC.lpi` using Lazarus.
22+
* Open `OneBRC.lpi` using Lazarus.
2123
* Hit `Ctrl + F9` to compile.
2224

2325
### Running the executable

entries/ikelaiah/src/OneBRC.lpr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
{$mode objfpc}{$H+}{$J-}{$modeSwitch advancedRecords}
2323
{$codepage utf8}
2424

25-
2625
uses
2726
{$IFDEF UNIX}
28-
cthreads,
27+
cmem, cthreads,
2928
{$ENDIF}
3029
Classes,
3130
SysUtils,

entries/ikelaiah/src/stopwatch.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ procedure DisplayTimer;
5353
seconds := elapsedMilliseconds div 1000;
5454
milliseconds := elapsedMilliseconds mod 1000;
5555

56-
WriteLn;
5756
WriteLn('------------------------------');
5857
WriteLn('Elapsed time: ', hours, ' hours ', minutes, ' minutes ',
5958
seconds, ' seconds ', milliseconds, ' milliseconds');
60-
//WriteLn('Elapsed time: ', (endTime - startTime), ' ms');
59+
WriteLn('------------------------------');
6160
end;
6261

6362

0 commit comments

Comments
 (0)