[Lazarus] Designer speedup, issue #37706, Sven Barth

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Designer speedup, issue #37706, Sven Barth

Free Pascal - Lazarus mailing list
Partly inspired by issue
I profiled Lazarus code with Valgrind to find what could cause such a slowdown in form designer.
I didn't see any serious slowdown myself but clearly the designer eats more resources than it should.
Registered components were searched all the time by class name. I changed the cache to use class type instead. It actually simplified and sped up things. It is function TBaseComponentPalette.FindRegComponent (was FindComponent) which is called also when mouse moves over the designer.
The biggest change is in r64182.
In r64184 I changed more code to use the component class type cache. By surprise it caused extreme slowdown. Selecting a component in designer took > 5 seconds with QT5 bindings, but the CPU was not under load. In addition with GTK2 bindings the selection dots didn't show.
All that was gone after a clean build!
What could cause it? I have no idea. A Sleep() call or Thread.WaitFor could cause a delay without CPU load but the code had neither.
Anyway please test with the latest changes. Build clean if you need to.

I want to optimize function TPkgManager.GetUnitsAndDepsForComps.
It is part of Sven Barth's recent addition. 
It has 2 nested for-loops. The inner is :
    for CurUnitIdx:=0 to CurUnitNames.Count-1 do
just after an item is added to CurUnitNames. Maybe the loops should go after each other instead of being nested. Now it may indeed be slow with a densely populated form.
Comments?

Regards,
Juha


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Designer speedup, issue #37706, Sven Barth

Free Pascal - Lazarus mailing list
On Wed, Dec 9, 2020 at 2:56 AM Juha Manninen <[hidden email]> wrote:
I want to optimize function TPkgManager.GetUnitsAndDepsForComps.

Actually that function is OK. I finally understood what it does.
In r64188 I changed MainIDE.PropHookPersistentAdded so that it gets dependencies only for the newly added component instead of all components on a form.
It surely affects speed with densely populated forms.
Please test.

Regards,
Juha


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus