When our TTable is created, the Create constructor is called for TTable, and for each ancestor class that overrides the Create constructor, all the way to TComponent.Create. Here's the implementation for the TComponent.Create method:
constructor TComponent.Create(AOwner: TComponent) ;
begin
FComponentStyle := [csInheritable];
if AOwner <> nil then AOwner.InsertComponent(Self) ;
end;
Notice that if AOwner is nil, the Create constructor is extremely fast. However, if AOwner is not nil, then AOwner's InsertComponent method is called. InsertComponent looks like this:
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TComponent.InsertComponent(AComponent: TComponent) ;
begin
AComponent.ValidateContainer(Self) ;
ValidateRename(AComponent, '', AComponent.FName) ;
Insert(AComponent) ;
AComponent.SetReference(True) ;
if csDesigning in ComponentState then
AComponent.SetDesigning(True) ;
Notification(AComponent, opInsert) ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Note: A test program was created in Delphi to time the dynamic creation of 1000 components with varying initial component counts.


