Skip to content

Commit 7a282a4

Browse files
authored
Merge pull request #136 from georges-hatem/main
description of the configurations to compile / run + LEMIRE hash
2 parents abc6f04 + c1857b3 commit 7a282a4

File tree

3 files changed

+69
-2
lines changed

3 files changed

+69
-2
lines changed

entries/ghatem-fpc/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77
## Usage
88
- -t flag to specify the thread-count (default reads the thread-count available on the CPU)
9+
10+
currently there are 3 configurations that can be compiled / run:
11+
- `HASHMOD`: uses modulus for hashing, least collisions
12+
- `HASHMULT`: alternative hashing, more collisions, faster on my PC, but seemingly slower on test PCs
13+
- `LEMIRE`: faster hash function calculation, most collisions it seems, yet the fastest on my PC
914

1015
## Hardware + Environment
1116
host:

entries/ghatem-fpc/src/OneBRCproj.lpi

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<UseAppBundle Value="False"/>
1616
<ResourceType Value="res"/>
1717
</General>
18-
<BuildModes Count="5">
18+
<BuildModes Count="7">
1919
<Item1 Name="Default" Default="True"/>
2020
<Item2 Name="Debug">
2121
<CompilerOptions>
@@ -137,6 +137,64 @@
137137
</Other>
138138
</CompilerOptions>
139139
</Item5>
140+
<Item6 Name="HashMod">
141+
<CompilerOptions>
142+
<Version Value="11"/>
143+
<PathDelim Value="\"/>
144+
<Target>
145+
<Filename Value="..\..\..\bin\ghatem"/>
146+
</Target>
147+
<SearchPaths>
148+
<IncludeFiles Value="$(ProjOutDir)"/>
149+
<UnitOutputDirectory Value="..\..\..\bin\lib\$(TargetCPU)-$(TargetOS)"/>
150+
</SearchPaths>
151+
<CodeGeneration>
152+
<SmartLinkUnit Value="True"/>
153+
<Optimizations>
154+
<OptimizationLevel Value="3"/>
155+
</Optimizations>
156+
</CodeGeneration>
157+
<Linking>
158+
<Debugging>
159+
<GenerateDebugInfo Value="False"/>
160+
<RunWithoutDebug Value="True"/>
161+
</Debugging>
162+
<LinkSmart Value="True"/>
163+
</Linking>
164+
<Other>
165+
<CustomOptions Value="-dRELEASE -dHASHMOD"/>
166+
</Other>
167+
</CompilerOptions>
168+
</Item6>
169+
<Item7 Name="LEMIRE">
170+
<CompilerOptions>
171+
<Version Value="11"/>
172+
<PathDelim Value="\"/>
173+
<Target>
174+
<Filename Value="..\..\..\bin\ghatem"/>
175+
</Target>
176+
<SearchPaths>
177+
<IncludeFiles Value="$(ProjOutDir)"/>
178+
<UnitOutputDirectory Value="..\..\..\bin\lib\$(TargetCPU)-$(TargetOS)"/>
179+
</SearchPaths>
180+
<CodeGeneration>
181+
<SmartLinkUnit Value="True"/>
182+
<Optimizations>
183+
<OptimizationLevel Value="3"/>
184+
</Optimizations>
185+
</CodeGeneration>
186+
<Linking>
187+
<Debugging>
188+
<GenerateDebugInfo Value="False"/>
189+
<RunWithoutDebug Value="True"/>
190+
</Debugging>
191+
<LinkSmart Value="True"/>
192+
</Linking>
193+
<Other>
194+
<CustomOptions Value="-dRELEASE -dLEMIRE"/>
195+
</Other>
196+
</CompilerOptions>
197+
</Item7>
140198
</BuildModes>
141199
<PublishOptions>
142200
<Version Value="2"/>

entries/ghatem-fpc/src/onebrc.pas

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,11 @@ procedure TMyDictionary.InternalFind(const aKey: Cardinal; out aFound: Boolean;
140140
vDbl := aKey * cHashConst;
141141
vDbl := vDbl - Trunc (vDbl);
142142
vIdx := Trunc (vDbl * cDictSize);
143-
{$ELSE}
143+
{$ENDIF}
144+
{$IFDEF LEMIRE}
145+
vIdx := aKey * cDictSize shr 32;
146+
{$ENDIF}
147+
{$IFDEF HASHMOD}
144148
vIdx := aKey mod cDictSize;
145149
{$ENDIF}
146150

0 commit comments

Comments
 (0)