⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 一个速度很快的文字排序引擎(TextSort engine)
💻 TXT
字号:
These units demonstrate the implementation of a TextSort engine,
which uses a three-way merge for Memory and a five-way merge for files.
I've wrote this because I've wasted so mucht time waiting for sorting.
It's very fast, one Million lines with an average length of 40 in 210 seconds.
It isn't true that QuickSort is the fastest Algorithm available.
This is only true for pure Integer or Word arrays.
With text or records MergeSort can compete and is in many cases faster.
In all cases of interrest it may be slightly slower in the worst case but
it can overcome Quicksort several times, especialy with large keys or
a time intensive comparision like AnsiCompareText.

This implementation is very fast but not the fastest possible.
There are some ways to improve it.

You can compile it with Delphi 2+3 and the BCB, with little changes with
Delphi 1 too.
It will be fast with Delphi 1 too, because it can run in little memory.

TTextSort has no compare function:
You mu遲 provide one like this!

function Compare(Item1, Item2: Pointer): Integer;
begin
   Result:= CompareText(PMergeData(Item1)^.Data, PMergeData(Item2)^.Data);
end;

Put it with the constructor.
TextSort:= TTextSort.Create(Compare);

With MaxLines you can determine the maximum number of lines for the in-memory
merge. More than 200000 are seldom useful. 
With MaxMem you can determine the maximum number of Bytes for the in-memory
merge. More than 1/3 of main momory is seldom useful. 

E-Mail me at Martin.Waldenburg@t-online.de
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -