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

Sven Barth pascaldragon at googlemail.com
Sat Jan 29 17:31:37 CET 2011

On 29.01.2011 16:08, Florian Klaempfl wrote:
> Am 29.01.2011 13:25, schrieb Sven Barth:
>> Do you (especially @Devs) think that this is a sufficient approach or
>> should this be done another way? (Note: I have not yet profiled
>> compiling the compiler once with that search enabled and once without)
> Profile compiler compilation first, then we can decide what to do.

Done. Differences are dramatic (at least on my Linux PC)

Used command:
time make cycle > /dev/null

Both variants use Revision 16834 of my branch, but variant two has the 
following change:

==== patch begin ====
Index: /mnt/media/subversion/fpc-classhelpers/compiler/symtable.pas
--- /mnt/media/subversion/fpc-classhelpers/compiler/symtable.pas 
(Revision 16835)
+++ /mnt/media/subversion/fpc-classhelpers/compiler/symtable.pas 
@@ -2138,12 +2138,12 @@
          { search for a class helper method first if this is an Object 
            class }
-        if is_class(classh) then
+        {if is_class(classh) then
              if result then
-          end;
+          end;}

          { in case this is a formal objcclass, first find the real 
definition }
==== patch end ====

Results Variant 1:

Run 1:
real	5m18.444s
user	3m57.075s
sys	0m4.806s

Run 2:
real	5m5.727s
user	3m53.811s
sys	0m4.426s

Run 3:
real	5m5.094s
user	3m54.475s
sys	0m4.676s

Results Variant 2:

Run 1:
real	1m7.982s
user	0m46.024s
sys	0m4.390s

Run 2:
real	1m8.619s
user	0m46.104s
sys	0m4.513s

Run 3:
real	1m10.078s
user	0m46.290s
sys	0m4.333s

It seems rather obvious that my search algorithm isn't a good idea ^^

>> Perhaps searching for class helpers should be made dependent on a
>> modeswitch? E.g. "useclasshelpers"
>> That might lead to the potentially confusing behavior that a class
>> helper is not even found in its own unit though, although I think that
>> this would be a consequent behavior (the switch needs to be documented
>> good enough though ^^).
> I think this is too dangerous.

Would you please explain why you think so?

>> What is the difference between the "Message*" and "CGMessage*"
>> procedures? Or asked differently: when should I use which?
> During code generation, use CGMessage*

I hope to notice when I'm in code generation then ^^


More information about the fpc-devel mailing list