[fpc-devel] Status report for "class helpers"

Paul Ishenin webpirat at mail.ru
Sun Jan 30 15:10:41 CET 2011


30.01.2011 19:41, Sven Barth wrote:
>>
>> procedure update_unit_symtable_options;
>> var
>> st: tsymtable;
>> begin
>> st:=owner;
>> while not(st.symtabletype in [globalsymtable,staticsymtable]) do
>> st:=st.defowner.owner;
>> if objecttype in [odt_classhelper,odt_objccategory] then
>> include(st.tableoptions,sto_has_classhelper);
>> end;
>>
>> remove "if objecttype in [odt_classhelper,odt_objccategory] then" from
>> this routine to outside - so you will not need to scan owners in the
>> loop for all object types.
> I still see an ability to optimize your implementation.
>
> Sorry, but I don't understand your intention here.
procedure update_unit_symtable_options;
var
st: tsymtable;
begin
st:=owner;
while not(st.symtabletype in [globalsymtable,staticsymtable]) do
st:=st.defowner.owner;
include(st.tableoptions,sto_has_classhelper);
end;

if objecttype in [odt_classhelper,odt_objccategory] then
    update_unit_symtable_options;

This will work faster because loop and the function call will run not 
for all object types.

Best regards,
Paul Ishenin



More information about the fpc-devel mailing list