Skip to content

Commit f2b7f81

Browse files
committed
hash-list optimized, small improvements in parsing the file
1 parent 4005c3d commit f2b7f81

File tree

3 files changed

+290
-105
lines changed

3 files changed

+290
-105
lines changed

entries/hgrosser/README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
1-
# Hartmut Grosser #
1+
# Hartmut Grosser
22

3-
# 1 billion row Challenge entry #
3+
**1 billion row Challenge entry**
44

5-
# Version #
6-
Version 1.0
5+
## Version
6+
Version 1.50
77

8-
# How to compile #
8+
## How to compile
99
The program was developed with FPC 3.2.2 and Lazarus 2.2.4
1010

11-
# How to start #
11+
## How to start
1212
```
13-
Usage: hgrosser <path to input file> [buffer size in kb (Default=128 kb)]
14-
Example: hgrosser ./measurements.txt 128
13+
Usage: <path to input file> <bit-width for hash-list (14..28)>
14+
Example: hgrosser measurements.txt 15
15+
- bit-width for hash-list: sets the size of the hash list, e.g. '16' => 65536 entries
1516
```
16-
There are no switches like '-i' etc, only values.
17+
There are no switches like `-i` etc, only values.
1718

18-
Please start the program 3 times with buffer sizes of '128', '192' and '256'.
19+
### Optimizing the 2nd command line parameter
1920

20-
# How the program works #
21+
In theory the program should run faster with greater bit-widths for the hash-list (because of less collisions), but on my own computer (8 GB RAM) in praxis a small value of 15 is the fastest way, allthough this causes many collisions.
22+
23+
Please (if possible) try all values from 14 to 24 (maybe in a for-loop). Thanks a lot.
24+
25+
## How the program works
2126
The Program works with 1 thread.
2227

2328
To speed things up:
2429

2530
- the input file is read via procedure 'blockread' ...
2631
- into an AnsiString, so that function 'PosEx' can be used to parse it
27-
- to manage the city names, a 'TFPHashList' is used
32+
- to manage the city names, a self made hash-list is used
2833
- temperatures are stored as integers (multiplied by 10)
34+
35+
## History
36+
37+
- Version 1.00: initial version
38+
- Version 1.50: hash-list optimized, small improvements in parsing the file

entries/hgrosser/src/1brc.lpi

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,73 @@
1818
<i18n>
1919
<EnableI18N LFM="False"/>
2020
</i18n>
21-
<BuildModes Count="1">
21+
<BuildModes Count="3">
2222
<Item1 Name="Default" Default="True"/>
23+
<Item2 Name="Debug">
24+
<CompilerOptions>
25+
<Version Value="11"/>
26+
<Target>
27+
<Filename Value="../../../bin/hgrosser"/>
28+
</Target>
29+
<SearchPaths>
30+
<IncludeFiles Value="$(ProjOutDir)"/>
31+
<UnitOutputDirectory Value="../../../bin/lib/$(TargetCPU)-$(TargetOS)"/>
32+
</SearchPaths>
33+
<Parsing>
34+
<SyntaxOptions>
35+
<SyntaxMode Value="tp"/>
36+
<IncludeAssertionCode Value="True"/>
37+
</SyntaxOptions>
38+
</Parsing>
39+
<CodeGeneration>
40+
<Checks>
41+
<IOChecks Value="True"/>
42+
<RangeChecks Value="True"/>
43+
<OverflowChecks Value="True"/>
44+
<StackChecks Value="True"/>
45+
</Checks>
46+
<VerifyObjMethodCallValidity Value="True"/>
47+
</CodeGeneration>
48+
<Linking>
49+
<Debugging>
50+
<DebugInfoType Value="dsDwarf3"/>
51+
<UseHeaptrc Value="True"/>
52+
<TrashVariables Value="True"/>
53+
<UseExternalDbgSyms Value="True"/>
54+
</Debugging>
55+
</Linking>
56+
</CompilerOptions>
57+
</Item2>
58+
<Item3 Name="Release">
59+
<CompilerOptions>
60+
<Version Value="11"/>
61+
<Target>
62+
<Filename Value="../../../bin/hgrosser"/>
63+
</Target>
64+
<SearchPaths>
65+
<IncludeFiles Value="$(ProjOutDir)"/>
66+
<UnitOutputDirectory Value="../../../bin/lib/$(TargetCPU)-$(TargetOS)"/>
67+
</SearchPaths>
68+
<Parsing>
69+
<SyntaxOptions>
70+
<SyntaxMode Value="tp"/>
71+
</SyntaxOptions>
72+
</Parsing>
73+
<CodeGeneration>
74+
<SmartLinkUnit Value="True"/>
75+
<Optimizations>
76+
<OptimizationLevel Value="3"/>
77+
</Optimizations>
78+
</CodeGeneration>
79+
<Linking>
80+
<Debugging>
81+
<GenerateDebugInfo Value="False"/>
82+
<RunWithoutDebug Value="True"/>
83+
</Debugging>
84+
<LinkSmart Value="True"/>
85+
</Linking>
86+
</CompilerOptions>
87+
</Item3>
2388
</BuildModes>
2489
<PublishOptions>
2590
<Version Value="2"/>

0 commit comments

Comments
 (0)