Announcement

Collapse
No announcement yet.

Tree.InsertNode - why so slowly?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tree.InsertNode - why so slowly?

    Some times (not each call) this function waste a lot of time. Is it normal?

    Example:

    Code:
    t1 = DLL.CallFunction("kernel32.dll", "GetTickCount", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    result = Tree.InsertNode(DEFAULT_NAMEDATABASE, table.NodeIndex, table);
    t2 = DLL.CallFunction("kernel32.dll", "GetTickCount", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    In my case t2-t1 is about 15-16ms sometimes. Sometimes it is ok (0 ms).

    PC with 4 cores x 1.6MHz, OS: Windows 7 x64

  • #2
    Try setting update false/true.

    Comment


    • #3
      Shrek

      I have learned properties of all Tree object but there is no property like Tree.SetUpdate.. Could you post an example? You mean SetEnabled property? If any object (Tree and etc) disabled it won't be redraw while its properties changing?

      Thanks

      Comment


      • #4
        Sorry, I figured it would have the option as the ListBox does, seems its not about consistency.

        Comment


        • #5
          15-16ms is not so large time
          that means you can insert 66 node per second

          notice that GetTickCount calculate the time before and after a script
          so
          it depends on script and any other process running like av , explorer ...... etc
          not the script only

          so it gives different results to the same script

          Comment


          • #6
            GetTickCount
            calculate the time that the pc takes
            not the time that the action script takes

            Comment


            • #7
              If you want to insert a number of nodes, you can use
              Code:
              Application.SetRedraw(false);
              before you start the insertions, and
              Code:
              Application.SetRedraw(true);
              once you are done. This way, the control won't be redrawn on each insertion and the whole process may perform much faster.

              Ulrich

              Comment


              • #8
                [Ulrich]

                Thank you for your helpful reply

                Comment

                Working...
                X