Search code examples
inno-setuppascalpascalscript

Does splitting Inno Setup Pascal Script code to sub functions/sub-procedures impact performace?


I'm creating all the pages directly on InitializedWizard section (they don't have order of creating for Example; Page2, Page5, Page1) like

procedure InitializeWizard;
var
  Text : TLabel;
Begin
  Page2 := CreateCustomPage(Page1.ID, '', '');
  Text := TLabel.Create(page2);
  Text.Left := ScaleX(0);
  Text.Top := ScaleY(35);
  Text.Caption := ''; 
  Text.Parent:= Page2.Surface;

  Page5 := CreateCustomPage(Page4.ID, '', '');
  Text := TLabel.Create(Page5);
  Text.Left := ScaleX(0);
  Text.Top := ScaleY(35);
  Text.Caption := ''; 
  Text.Parent := Page5.Surface;
End;

I there is a difference, if I create the pages on separated procedures, and then call them in InitializeWizard like this?

procedure CreatePage1;
var
  Text : TLabel;
begin
  Page2:= CreateCustomPage(Page1.ID, '', '');
  Text := TLabel.Create(Page2);
  Text.Left := ScaleX(0);
  Text.Top := ScaleY(35);
  Text.Caption := 'Tickets Printer'; 
  Text.Parent := Page2.Surface;
end;  

procedure InitializeWizard;
begin
  CreatePage1();
  CreatePage2();
  CreatePage3();
end;

Solution

  • There's no practical performance difference between:

    procedure Master;
    begin
      Statement1;
      Statement2;
    end;
    

    and

    procedure Child1;
    begin
      Statement1;
    end;
    
    procedure Child2;
    begin
      Statement2;
    end;
    
    procedure Master;
    begin
      Child1;
      Child2;
    end;
    

    If that's, what you ask.