[fpc-devel] TList slowness in classes

Michalis Kamburelis michalis at camelot.homedns.org
Sat Dec 25 08:35:39 CET 2004


I felt that results of this discussion are so important that I created a 
page in FPC wiki about it:

http://www.freepascal.org/wiki/index.php/Avoiding_implicit_try_finally_section

There's an URL to mail archives of this discussion, and a small demo 
program that shows trick proposed by Mattias how to avoid this implicit 
try...finally block.

(I also created Writing_efficient_code page, that links between FPC page 
and Avoiding_implicit_try_finally_section page).

Michalis.

Michael Van Canneyt wrote:
> 
> On Fri, 24 Dec 2004, Mattias Gaertner wrote:
> 
> 
>>On Fri, 24 Dec 2004 11:49:10 +0100 (W. Europe Standard Time)
>>Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:
>>
>>
>>>
>>>On Fri, 24 Dec 2004, Mattias Gaertner wrote:
>>>
>>>
>>>>On Fri, 24 Dec 2004 10:56:24 +0100 (W. Europe Standard Time)
>>>>Michael Van Canneyt <michael.vancanneyt at wisa.be> wrote:
>>>>
>>>>
>>>>>>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} ?
>>>>
>>>>Why not put it into a sub proc:
>>>>
>>>>function TList.Get(Index: Integer): Pointer;
>>>>
>>>>  procedure RaiseIndexError;
>>>>  begin
>>>>    Error(SListIndexError,Index);
>>>>  end;
>>>>
>>>>begin
>>>>  If (Index<0) or (Index>=FCount) then
>>>>    RaiseIndexError;
>>>>  Result:=FList^[Index];
>>>>end;
>>>>
>>>
>>>The compiler detects that the sub can raise an exception.
>>
>>And creates the implicit exception frame only in RaiseIndexError.
> 
> 
> I have changed the procedure.
> 
> Michael.
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 




More information about the fpc-devel mailing list