Skip to content

Commit 60fa0be

Browse files
committed
remove slow hash functions
1 parent af54f65 commit 60fa0be

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

entries/ghatem-fpc/src/onebrc.pas

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,9 @@ function Compare(AList: TStringList; AIndex1, AIndex2: Integer): Integer;
133133

134134
procedure TMyDictionary.InternalFind(const aKey: Cardinal; out aFound: Boolean; out aIndex: Integer);
135135
var vIdx: Integer;
136-
vDbl: Double;
137136
vOffset: Integer;
138137
begin
139-
{$IFDEF HASHMULT}
140-
vDbl := aKey * cHashConst;
141-
vDbl := vDbl - Trunc (vDbl);
142-
vIdx := Trunc (vDbl * cDictSize);
143-
{$ENDIF}
144-
{$IFDEF LEMIRE}
145138
vIdx := aKey * cDictSize shr 32;
146-
{$ENDIF}
147-
{$IFDEF HASHMOD}
148-
vIdx := aKey mod cDictSize;
149-
{$ENDIF}
150-
151-
aFound := False;
152139

153140
if FHashes[vIdx] = aKey then begin
154141
aIndex := vIdx;
@@ -170,8 +157,8 @@ procedure TMyDictionary.InternalFind(const aKey: Cardinal; out aFound: Boolean;
170157
aIndex := vIdx;
171158
aFound := True;
172159
break;
173-
end
174-
else if FHashes[vIdx] = 0 then begin
160+
end;
161+
if FHashes[vIdx] = 0 then begin
175162
// found empty bucket to use
176163
aIndex := vIdx;
177164
aFound := False;

0 commit comments

Comments
 (0)