I wrote a component editor that can insert some components on a form or data module. But when I insert many components, the performance of lazarus is terrible. Inserting 510 components on my I5 540M with 8Gb of Ram takes 14 seconds. If I try insert 1020 components, this action takes 52 seconds.<div>
If I try insert 4000 components, I don't know how many time this action takes, because it freezes the Lazarus for a long time.<br><br>My component editor class has two methods:<br><br><font class="Apple-style-span" face="'courier new', monospace">procedure TInsertTagsOnFormComponentEditor.AddTagInEditor(Tag:TTag);<br>
{$IFDEF FPC}<br>var<br> Hook: TPropertyEditorHook;<br>{$ENDIF}<br>begin<br>{$IFDEF FPC}<br> Hook:=nil;<br> if not GetHook(Hook) then exit;<br> Hook.PersistentAdded(Tag,false);<br> Modified;<br>{$ELSE}<br> Designer.Modified;<br>
{$ENDIF}<br>end;<br><br>function TInsertTagsOnFormComponentEditor.CreateComponent(tagclass:TComponentClass):TComponent;<br>begin<br> {$IFDEF FPC}<br> Result := tagclass.Create(GetTheOwner);<br> {$ELSE}<br> Result := Designer.CreateComponent(tagclass,GetTheOwner,0,0,0,0);<br>
{$ENDIF}<br>end; </font><br><br><br>To use this editor, the component wizard call (to each component created):<br><br> <br><font class="Apple-style-span" face="'courier new', monospace">obj:= componentClass(compeditor.CreateComponent(componentClass));<br>
compeditor.AddTagInEditor(obj);</font><div><font class="Apple-style-span" face="'courier new', monospace"><br></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; ">Somebody did something like this? Am I doing something wrong? What's the Lazarus pieces that mus be improved to perform this action more fastest?</span></font></div>
</div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; "><br></span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; "><br>
</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; ">The best regards,</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; "><br>
</span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="font-family: arial; ">Fabio</span></font></div>