diff --git a/entries/ghatem-fpc/README.md b/entries/ghatem-fpc/README.md index 0cf1e53..02614d1 100644 --- a/entries/ghatem-fpc/README.md +++ b/entries/ghatem-fpc/README.md @@ -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: diff --git a/entries/ghatem-fpc/src/OneBRCproj.lpi b/entries/ghatem-fpc/src/OneBRCproj.lpi index 853c254..c19cbcd 100644 --- a/entries/ghatem-fpc/src/OneBRCproj.lpi +++ b/entries/ghatem-fpc/src/OneBRCproj.lpi @@ -15,7 +15,7 @@ - + @@ -137,6 +137,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/entries/ghatem-fpc/src/onebrc.pas b/entries/ghatem-fpc/src/onebrc.pas index 746c3db..d45e1b1 100644 --- a/entries/ghatem-fpc/src/onebrc.pas +++ b/entries/ghatem-fpc/src/onebrc.pas @@ -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}