1
0
mirror of synced 2024-12-22 09:13:07 +01:00

Changed: rewrote hashes to use an optimized Trie (bucket tree)

This commit is contained in:
Mark van Renswoude 2005-06-30 12:18:53 +00:00
parent 7edc96e0a4
commit c0c2052093
6 changed files with 32734 additions and 523 deletions

40
Test/X2UtHashesTest2.cfg Normal file
View File

@ -0,0 +1,40 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W+
-$X+
-$YD
-$Z1
-GD
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-DmadExcept
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

138
Test/X2UtHashesTest2.dof Normal file
View File

@ -0,0 +1,138 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=1
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=3
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;rtl;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;vclx;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;CLXIB;ibxpress;VCLIB;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;DJcl;JvStdCtrlsD7R;JvAppFrmD7R;JvCoreD7R;JvBandsD7R;JvCmpD7R;JvCryptD7R;JvCtrlsD7R;JvCustomD7R;JvDBD7R;JvDlgsD7R;JvDockingD7R;JvEDID7R;qrpt;JvGlobusD7R;JvHMID7R;JvInspectorD7R;JvInterpreterD7R;JvJansD7R;JvManagedThreadsD7R;JvMMD7R;JvNetD7R;JvPageCompsD7R;JvPluginD7R;JvPrintPreviewD7R;JvSystemD7R;JvTimeFrameworkD7R;JvValidatorsD7R;JvWizardD7R;tb2k_d7;tbx_d7;PNGImageD7;X2CLGL;rbDIDE77;rbDAD77;rbIDE77;rbRCL77;rbCIDE77;rbBDE77;tiPerListBoxD7D;tiPerListBoxD7R;tiPerAwareGUI;VirtualTreesD7;madBasic_;madDisAsm_;DIPcre_D7;GR32_DSGN_D7;GR32_D7;VirtualShellToolsD7;VirtualExplorerListviewExD7;BMSpinEditD6;B305vr70;CPBD7;K102_R70
Conditionals=madExcept
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1043
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlOutputDirectorry]
Count=1
Item0=..

111
Test/X2UtHashesTest2.dpr Normal file
View File

@ -0,0 +1,111 @@
program X2UtHashesTest2;
{$APPTYPE CONSOLE}
uses
madExcept,
madLinkDisAsm,
MemCheck,
SysUtils,
X2UtHashes;
{
var
fDic: TextFile;
iCount: Integer;
sWord: String;
}
begin
MemChk();
{
with TX2POHash.Create(True) do
try
Values[Pointer(0)] := TObject.Create();
Values[Pointer(1)] := TObject.Create();
Values[Pointer(0)] := TObject.Create();
finally
Free();
end;
}
(*
with TX2SIHash.Create() do
try
AssignFile(fDic, 'dic.txt');
try
iCount := 0;
Reset(fDic);
while not Eof(fDic) do
begin
ReadLn(fDic, sWord);
Values[sWord] := iCount;
Inc(iCount);
end;
WriteLn(iCount, ' items read');
WriteLn(Count, ' items in the hash');
Delete('ABUTTING');
Delete('ABUTTED');
Delete('ABUTTED');
WriteLn(Count, ' items in the hash after deleting');
iCount := 0;
First();
while Next() do
begin
//WriteLn(iCount, '. ', CurrentKey, '=', CurrentValue);
Inc(iCount);
end;
WriteLn(iCount, ' items iterated');
{
WriteLn(Exists('ABUTTING'));
WriteLn(Exists('AARDVARK'));
}
finally
CloseFile(fDic);
end;
finally
Free();
end;
*)
{
with TX2PPHash.Create() do
try
Values[Pointer(1)] := Pointer(1);
Values[Pointer(2)] := Pointer(2);
Values[Pointer(3)] := Pointer(3);
Values[Pointer(4)] := Pointer(4);
WriteLn(Integer(Values[Pointer(1)]));
WriteLn(Integer(Values[Pointer(2)]));
WriteLn(Integer(Values[Pointer(3)]));
WriteLn(Integer(Values[Pointer(4)]));
finally
Free();
end;
}
with TX2SSHash.Create() do
try
Values['Item1'] := 'Item1?';
Values['Item2'] := 'Item2?';
Values['Item3'] := 'Item3?';
Values['Item4'] := 'Item4?';
WriteLn(Values['Item1']);
WriteLn(Values['Item2']);
WriteLn(Values['Item3']);
WriteLn(Values['Item4']);
finally
Free();
end;
WriteLn('Done!');
ReadLn;
end.

66
Test/X2UtHashesTest2.mes Normal file
View File

@ -0,0 +1,66 @@
[GeneralSettings]
MesVersion=3
AppendMapFileToBinary=1
HandleExceptions=1
CheckForFrozenMainThread=0
FreezeTimeout=60000
ShowExceptionBox=1
SuspendAllRunningThreads=1
AutomaticallySaveBugReport=0
AutomaticallyMailBugReport=0
CopyBugReportToClipboard=1
AutomaticallyContinueApplication=0
AutomaticallyRestartApplication=0
AutomaticallyCloseApplication=0
MailAddress=
MailSubject=bug report
AttachBugReportFile=0
DeleteBugReportFile=0
ScreenShotDepth=0
MailAsSmtpServer=0
MailAsSmtpClient=0
MailViaMapi=1
MailViaMailto=1
SmtpServer=
SmtpPort=25
SmtpAccount=
SmtpPassword=
MailSuccessMsg=The mail was sent successfully.
MailFailureMsg=Sorry, sending the mail didn't work.
BugReportFile=bugreport.txt
AppendBugReports=1
BugReportFileSize=50000
VersionVariable=
[ExceptionBox]
TitleBar=%appname%
ExceptionMessage=An error occurred in the application.
FrozenMessage=The application seems to be frozen.
ShowButtonMailBugReport=1
ShowButtonSaveBugReport=0
ShowButtonPrintBugReport=0
ShowButtonShowBugReport=1
ShowButtonContinueApplication=1
ShowButtonRestartApplication=1
ShowButtonCloseApplication=1
MailBugReportText=mail bug report
SaveBugReportText=save bug report
PrintBugReportText=print bug report
ShowBugReportText=show bug report
ContinueApplicationText=continue application
RestartApplicationText=restart application
CloseApplicationText=close application
FocusedButton=0
AutomaticallyShowBugReport=0
[BugReport]
ListThreads=1
ListModules=1
ListHardware=1
Disassembly=1
HideUglyItems=0
ShowRelativeAddrs=0
ShowRelativeLines=0
FormatDisassembly=0
LimitDisassembly=5
[UnitInitOrder]
PatchUnitInitOrder=1
UnitInitOrder=ShareMem, HPMM, MultiMM, nxllFastCpuDetect, nxllFastFillChar, nxllFastMove, nxllMemoryManagerImpl, nxllFastCpuDetect, nxllFastFillChar, nxllFastMove, nxllMemoryManagerImpl, nxllMemoryManager, nxReplacementMemoryManager, dbisammm

30651
Test/dic.txt Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff