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

Sven Barth pascaldragon at googlemail.com
Sun Jan 30 18:26:44 CET 2011


On 30.01.2011 15:10, Paul Ishenin wrote:
> 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.

Now I understand. Thanks for clarification.

I've done that change.

Timings without that change:

Run 1:

real	1m3.461s
user	0m45.957s
sys	0m4.590s

Run 2:

real	1m10.777s
user	0m46.204s
sys	0m4.696s

Run 3:

real	1m11.596s
user	0m46.690s
sys	0m4.406s

Timings with that change:

Run 1:

real	1m8.919s
user	0m46.597s
sys	0m4.166s

Run 2:

real	1m9.359s
user	0m46.524s
sys	0m4.380s

Run 3:

real	1m8.342s
user	0m46.294s
sys	0m4.490s

Doesn't change much. For comparison timings without the search for class 
helpers (if-clause in symtable.pas/searchsym_in_class disabled):

Run 1:

real	1m5.040s
user	0m46.050s
sys	0m4.163s

Run 2:

real	1m4.008s
user	0m45.784s
sys	0m4.343s

Run 3:

real	1m6.074s
user	0m45.714s
sys	0m4.546s


It seems that I should have rerun the profiling without class helper 
search as well after I added the flag yesterday...

I'll nevertheless try to implement Jonas' suggestion to see whether this 
improves timing a bit more (and maybe the flags can be used to optimize 
the speed for other types of searches a bit more, like Paul suggested :D )

Regards,
Sven



More information about the fpc-devel mailing list