[Lazarus] In search of a component for holding a table of strings

Werner Pamler werner.pamler at freenet.de
Wed Jan 11 13:16:34 CET 2017

>>> There are two versions of this AVL trees: The FPC unit avltree and the
>>> LazUtils unit avglvltree. It is the same tree, but with different
>>> names to avoid conflicts.
>> Does this mean: I can directly replace the TAVLTree by the TAvgLvlTree
>> and the TAVLTreeNode by the TAvgLvlTreeNode to use the LazUtils tree and
>> everything works as before? No other changes?
> Yes.

I am attaching my "benchmark" program. The stringtable implemented here 
is a quick copy & paste from fpspreadsheet code with minor 
modifications. Setting the define "AVL_TREE" in the project options 
activates the fpc AVLTree behind the table, while undefining it uses the 
LazUtils tree.

When running the test you'll see that the LazUtils tree is almost a 
factor 2 slower than the fpc tree. (0.6 sec vs 0.36 sec for populating a 
1000x1000 table, 16 sec vs 9.8 sec for a 5000x5000 table). Any idea why 
the Lazarus tree is slower although the tree code should be the same, 

You'll see also that the new optimized AddAscendingSquence speeds things 
up considerably (4.6 sec vs 16 sec for 5000x5000). Since it calls the 
normal Add if the new node does not fit at its assumed position I 
suppose that nothing speaks against using this method as a general 
replacement of Add in fpspreadsheet.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: StringTable_TREE.zip
Type: application/x-zip-compressed
Size: 6523 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170111/79e2732f/attachment.bin>

More information about the Lazarus mailing list