[fpc-devel] TList slowness in classes

Michalis Kamburelis michalis at camelot.homedns.org
Fri Dec 24 10:53:07 CET 2004


Peter Vreman wrote:
>>>This is because there is an extra (implicit) Try/Finally block.
>>
>>Thank you and Peter for answers. This way I was able to see how
>>try...finally section looks in assembler :) Anyway, I understand that
>>the answer is "can't be speed up". OK, I can live with that.
> 
> 
> That is not correct. For your own code you can disable the implicit
> exception frame with a directive:
> 
> {$IMPLICITEXCEPTIONS OFF}
> 

Indeed when I put {$IMPLICITEXCEPTIONS OFF} at the beginning of 
demo_resourcestring_slow.pas, Foo_Normal and Foo_ResourceString work 
equally fast. Nice, that's a solution in cases when I know that some 
code will not exit with exception.

But I risk that if I ever call Foo_ResourceString(-1) that will raise 
exception from Foo_ResourceString, I can get memory leaks, right ? Or 
can I predict in certain cases that using {$IMPLICITEXCEPTIONS OFF} is 
safe (no memory leaks) even when procedure will raise some exceptions ? 
If the answer is yes, then maybe it's safe to compile parts of FPC 
sources in lists.inc (like TList.Get) inside {$IMPLICITEXCEPTIONS OFF} ?

-- 
Michalis




More information about the fpc-devel mailing list