बेशक आप सुनिश्चित हो सकते हैं, क्योंकि यह documented है। संकलक समय पर संकलित करने वाला संकलक है, इसलिए डेल्फी में अधिभारित कार्यों को कॉल करने पर कोई अतिरिक्त ओवरहेड नहीं है।
var
j: Integer;
st: string;
procedure DoNothing(i: Integer); overload;
begin
j := i;
end;
procedure DoNothing(s: string); overload;
begin
st := s;
end;
procedure DoNothingI(i: integer);
begin
j := i;
end;
procedure TForm2.Button1Click(Sender: TObject);
const
MaxIterations = 10000000;
var
StartTick, EndTick: Cardinal;
I: Integer;
begin
StartTick := GetTickCount;
for I := 0 to MaxIterations - 1 do
DoNothing(I);
EndTick := GetTickCount;
Label1.Caption := Format('Overlaod ellapsed ticks: %d [j:%d]', [EndTick - StartTick, j]);
StartTick := GetTickCount;
for I := 0 to MaxIterations - 1 do
DoNothingI(I);
EndTick := GetTickCount;
Label1.Caption := Format('%s'#13'Normal ellapsed ticks: %d [j:%d]', [Label1.Caption, EndTick - StartTick, j]);
end;
परिणाम::
[संपादित करें]
मैं तुम्हारे लिए एक छोटे से परीक्षण किया था मेरी देव मशीन पर दोनों के लिए लगभग सभी समय 31 Ticks (मिलीसेकेंड), कभी कभी अधिभार केवल 16 टिक लेता है ।
+1 आपने मुझे इसे हराया :) –
दाएं। संकलन-समय ओवरहेड की एक (नगण्य) राशि है, लेकिन रनटाइम पर कोई नहीं। –
संकलित कोड नाम के बारे में परवाह नहीं करता है लेकिन कॉल करने के लिए सही प्रक्रिया का पता नहीं है। चूंकि इस अनुवाद का नाम => पता संकलन समय पर किया जाता है, अंत में, रन टाइम पर, यह बिल्कुल अलग नाम होने जैसा ही होता है। –