Does function overloading have runtime overhead in Delphi? -



Does function overloading have runtime overhead in Delphi? -

is there additional runtime overhead in calling overloaded functions?

(i inquire delphi, in case reply isn't same compiled languages)

i think not should resolved during compile time, can never sure can you?

of course of study can sure, because documented. compiler resolves @ compile time, there's no additional overhead on calling overloaded functions in delphi.

[edit]

i did little test you:

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; := 0 maxiterations - 1 donothing(i); endtick := gettickcount; label1.caption := format('overlaod ellapsed ticks: %d [j:%d]', [endtick - starttick, j]); starttick := gettickcount; := 0 maxiterations - 1 donothingi(i); endtick := gettickcount; label1.caption := format('%s'#13'normal ellapsed ticks: %d [j:%d]', [label1.caption, endtick - starttick, j]); end;

result: time 31 ticks (milliseconds) both on dev machine, overload takes 16 ticks.

delphi function-overloading

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -