Reputation: 6041
In delphi, if you want to create COM object, you can do it in two ways,
the first one is early binding, for example,
uses
MSScriptControl_TLB; // MS Script Control
var
obj: IScriptControl;
begin
obj := CreateOleObject('ScriptControl') as IScriptControl;
..
..
obj.ExecuteStatement('Msgbox 1')
end;
Or, you can do it as following (late binding)
var
obj: OleVariant;
begin
obj := CreateOleObject('ScriptControl') ;
obj.ExecuteStatement('Msgbox 1');
end;
which one is better in terms of performance?
Upvotes: 8
Views: 1081
Reputation: 612794
Which one is better in terms of performance?
Early bound is quicker than late bound. Late bound method dispatch involves the following:
Many of these steps are not present at all for early bound dispatch.
Of course, if the function does anything significant at all, the performance different during method dispatch may well not be detectable.
Upvotes: 12