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Ай бұрын
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Ай бұрын
"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Ай бұрын
@@galdariah What do you mean by "set the position (Top and Left) from another component."
@galdariahАй бұрын
@@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Ай бұрын
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.
@codegearguru29 күн бұрын
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Ай бұрын
Would be nice if you can check if there is any performance difference if you enable the new skia embedded Framework.
@codegearguruАй бұрын
Skia would help a fmx application - I'll give it a go at some point.
@fburton8Ай бұрын
I assume that BeginUpdate / EndUpdate isn’t applicable in this situation.
@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Ай бұрын
Yes, a follow-up question is whether e.g. Visible := false in combination with SetBounds is better
@codegearguru29 күн бұрын
I'll probably do a follow up on this, probably using FMX and not using the TGridPanel with the VCL.
@codegearguru29 күн бұрын
Yes, it will likely be better as it reduces the number of times the components are re-rendered by half.
@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Ай бұрын
It might be marginally faster, but didn't make a big difference.