ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

Ways to Improve VCL Rendering Times - Delphi 236

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2024
  • LearnDelphi.tv In this video, I did some experiments to see how I could improve the rendering performance of controls in the VCL when changing the layout of a form.

ความคิดเห็น • 17

  • @Graham_Wideman
    @Graham_Wideman หลายเดือนก่อน +1

    Alister -- this demo runs spectacularly slowly compared to my experience with Delphi UIs, which triggers a suspicion that there's some excessive calculations going on. I see you have the buttons set to alClient, and I can't tell if the grid is set to adapt to size of contained controls... which could interact with each other. Regardless, it would clarify considerably if you would create a simple baseline case of just creating and showing 400 buttons that have a fixed height and width, position at constant Left and Top locations (as calculated by the create loop). You could do a similar test where your "redraw" button repositions and/or tesizes the buttons, again providing them with constant new positions/sizes. That would shed some light as to whether your current test case might be triggering some pathological recursive calculations or something else like recursive flood of events.

    • @galdariah
      @galdariah หลายเดือนก่อน

      "Just creating and showing 400 buttons that have a fixed height and width, position at constant Left and Top locations"
      The biggest VCL problem is when you must set the position (Top and Left) from another component.

    • @Graham_Wideman
      @Graham_Wideman หลายเดือนก่อน

      @@galdariah What do you mean by "set the position (Top and Left) from another component."

    • @galdariah
      @galdariah หลายเดือนก่อน +1

      ​@@Graham_Wideman I made a mistake. In Delphi, to choose a position, we need to manually drag the component to adjust its position. For example, a TPanel with 5 TButtons aligned to alLeft. If you want to dynamically create these buttons, you have to create them in the corresponding order. LCL has a complex Anchor system, and that was my mistake.

    • @fburton8
      @fburton8 หลายเดือนก่อน

      I agree, it seems terribly slow for this day and age. When I get time, I’ll try the same code on my legacy Delphi 7 system to see if that is any different.
      Edited to add: Using Delphi 7 on an HP Z2 Mini G4, I get ~1 second for a straight resize and ~0.5 seconds when I do the resizing with the visibility of the panel set to false. However, as TGridPanel isn't available in Delphi 7, I used a plain TPanel to trigger resizing and set the size and position of all the buttons inside the panel (and stored in an array) myself using SetBounds. This seemed more straightforward than messing with a TDrawGrid.
      Manually resizing the window still results in noticeably laggy UI performance though, so if I really wanted to get the effect of a 2D array of buttons in a snappy interface I would probably draw them myself.

    • @codegearguru
      @codegearguru  21 วันที่ผ่านมา +1

      I think I'll need to re-try this laying out the buttons manually, rather than using the TGridPanel. It does seem to be slower than I would expect.

  • @MaximilianMusterma
    @MaximilianMusterma หลายเดือนก่อน +2

    Would be nice if you can check if there is any performance difference if you enable the new skia embedded Framework.

    • @codegearguru
      @codegearguru  หลายเดือนก่อน

      Skia would help a fmx application - I'll give it a go at some point.

  • @fburton8
    @fburton8 หลายเดือนก่อน

    I assume that BeginUpdate / EndUpdate isn’t applicable in this situation.

  • @freezer86
    @freezer86 หลายเดือนก่อน

    Well.. it's not quite improving of rendering. BTW: You did not try to disable runtime themes (checkbox in Application->manifest) it's will "improve" unstyled version.

    • @codegearguru
      @codegearguru  หลายเดือนก่อน

      It might be marginally faster, but didn't make a big difference.

  • @galdariah
    @galdariah หลายเดือนก่อน

    I was expecting one last compilation with all these ways, lol.
    Embarcadero has much to improve on VLC speed, considering LCL is many times faster.

    • @JanDoggen
      @JanDoggen หลายเดือนก่อน

      Yes, a follow-up question is whether e.g. Visible := false in combination with SetBounds is better

    • @codegearguru
      @codegearguru  21 วันที่ผ่านมา

      I'll probably do a follow up on this, probably using FMX and not using the TGridPanel with the VCL.

    • @codegearguru
      @codegearguru  21 วันที่ผ่านมา

      Yes, it will likely be better as it reduces the number of times the components are re-rendered by half.