Recent

Author Topic: VirtualStringTree very slow  (Read 327 times)

regs

  • New Member
  • *
  • Posts: 48
VirtualStringTree very slow
« on: January 06, 2021, 06:03:19 pm »
How do I correctly populate VirtualStringTree? It looks very slow to me. 6500 rows takes 3 seconds. 100000 takes 5,5 minutes. Dataarray demo does it in 170 ms. I tried to do all VST properties same. It's reduced to 20 seconds, disabling AutoSort is most notable, but it's still whopping 20 seconds. Am I missing something?

GetMem

  • Hero Member
  • *****
  • Posts: 3859
Re: VirtualStringTree very slow
« Reply #1 on: January 06, 2021, 06:16:42 pm »
Hi regs,

Try this:
Code: Pascal  [Select][+][-]
  1.   VirtualStringTree1.RootNodeCount := 100001;
  2.   VirtualStringTree1.BeginUpdate;
  3.   try
  4.     for nCounter := 0 to 100000 do
  5.       VirtualStringTree1.AddChild(nil);
  6.   finally
  7.     VirtualStringTree1.EndUpdate;
  8.   end;
  9.  

The code should be at least 100x faster.

regs

  • New Member
  • *
  • Posts: 48
Re: VirtualStringTree very slow
« Reply #2 on: January 06, 2021, 07:00:19 pm »
right, forgot of beginupdate and endupdate

 

TinyPortal © 2005-2018