I had quite an interesting result when I looked further into the performance of this type of function..

I ran the test 10 times, starting with a 0% failiure rate for the inner procedure and increasing each time by 10%.


Here's my code: Note label1 is a valid control on the form.

Code:
var
   count : integer;
   loop, bigloop : integer;
   start : cardinal;

   fred : TLabel;
begin

 for bigloop := 0 to 10 do
 begin
     count:=0;
     fred:=nil;

     start:=getTickCount;

     for loop:=1 to 1000000 do
         begin
              inc(count);

              if random*10 > bigloop then fred := label1
              else fred := nil;

              if &#40;fred<>nil&#41; then
                 fred.caption&#58;='Hello';
         end;

     memo1.lines.add&#40;'No Try &#58; '+intToStr&#40;getTickCount-start&#41;&#41;;

     count&#58;=0;

     start&#58;=getTickCount;
     for loop&#58;=1 to 1000000 do
         begin
              try
                 inc&#40;count&#41;;

                 if random*10 > bigloop then fred &#58;= label1
                 else fred &#58;= nil;

                 fred.caption&#58;='Hello';
              except
              end;
         end;

     memo1.lines.add&#40;'Try &#58; '+intToStr&#40;getTickCount-start&#41;&#41;;
     memo1.lines.add&#40;' '&#41;;
 end;
end;
And it turns out that if your function works fine almost all the time (ie. a best case), a try except clause is actually *slightly* faster! I guess this is because the Non-Try code has one extra If Then statement. But from about 10-15% failiure rate, the overhead of the try except clause can be seen, and it is pretty big...



P.S. Dont quote me here. Does it look believeable to you? Have I got my 'math' right?