Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions entries/ghatem-fpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

## Usage
- -t flag to specify the thread-count (default reads the thread-count available on the CPU)

currently there are 3 configurations that can be compiled / run:
- `HASHMOD`: uses modulus for hashing, least collisions
- `HASHMULT`: alternative hashing, more collisions, faster on my PC, but seemingly slower on test PCs
- `LEMIRE`: faster hash function calculation, most collisions it seems, yet the fastest on my PC

## Hardware + Environment
host:
Expand Down
60 changes: 59 additions & 1 deletion entries/ghatem-fpc/src/OneBRCproj.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="5">
<BuildModes Count="7">
<Item1 Name="Default" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
Expand Down Expand Up @@ -137,6 +137,64 @@
</Other>
</CompilerOptions>
</Item5>
<Item6 Name="HashMod">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="..\..\..\bin\ghatem"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="..\..\..\bin\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<RunWithoutDebug Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CustomOptions Value="-dRELEASE -dHASHMOD"/>
</Other>
</CompilerOptions>
</Item6>
<Item7 Name="LEMIRE">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="..\..\..\bin\ghatem"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="..\..\..\bin\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<RunWithoutDebug Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CustomOptions Value="-dRELEASE -dLEMIRE"/>
</Other>
</CompilerOptions>
</Item7>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
Expand Down
6 changes: 5 additions & 1 deletion entries/ghatem-fpc/src/onebrc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ procedure TMyDictionary.InternalFind(const aKey: Cardinal; out aFound: Boolean;
vDbl := aKey * cHashConst;
vDbl := vDbl - Trunc (vDbl);
vIdx := Trunc (vDbl * cDictSize);
{$ELSE}
{$ENDIF}
{$IFDEF LEMIRE}
vIdx := aKey * cDictSize shr 32;
{$ENDIF}
{$IFDEF HASHMOD}
vIdx := aKey mod cDictSize;
{$ENDIF}

Expand Down