On 1/10/17, Werner Pamler via Lazarus <lazarus@lists.lazarus-ide.org> wrote:
> Ah - that's the explanation: you did your test with a predimensioned > table? Mine started with an empty table, and with every new cell the > tree sorts the new cell to the correct location and rebalances itself. > It would be interesting to compare with your table in the same way. I fill my table per row, that is I collect 1 row of data at the time (adding it to a tmp variable) then add the row to the table. Adding cell by cell would be even more inefficient (at least in the beginning), but at some point you won't need to increase rowcount anymore. But the GetCell/SetCell is not the most efficient way of adding data. My test scenario is: I create an array of array of string (Z) and fill that with strings in the form of 'ColX:RowY'. I then iterate the Z and do AddRow(Z[i]), this adds a row and copies the data from Z[i], using a simple for loop (maybe can be made more efficient). So there are only 2 operations, copying is probably faster then inserting into a Tree. The good point about this is that creating a row also initializes it's values, since a row is an array of string and SetLength sets all values to nil/0. Note: the creating and populating of Z takes up the most time (up to 10 seconds). Bart -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus