[GAP Forum] Mystry call to Order

Arnaldo Mandel am at ime.usp.br
Wed Jul 16 19:01:32 BST 2008

Alexander Hulpke wrote (on Jul 16, 2008):
 > Dear Armando Mandel, Dear Forum,

Hello Aexander, hello Forum and hello Armando, whoever you are :-)
 > > As you can see, Order takes up all the time. However, Complete does
 > > not involve any group.
 > This is a known problem in the profiling code. 

Maybe it should be documented.

 >                                                The call in question is  
 > `Size'.

Of course...
Well, this little tip was enough (see below)!

 >   what is happening, however, is that there is a method installation  
 > for `Order'  for groups (in lib/grp.gi) for which the method is simply  
 > the operation `Size'. This means, that the function `Size' internally  
 > gets labeled as a *method*  for the operation `Order' for groups.
 > unfortunately this is not easily fixed: doing so would require an  
 > extra indirection when calling methods, which are operations  
 > themselves. This would slow things down a little bit. In view of this,  
 > I would argue that the mislabeling of the profile is the lesser evil.

No problem, so long I am aware of it.  

Your remarks about how profiling may be self-deceiving occasionally
notwithstanding, profiling was smack in the head this time.  There
were definitely many calls to Size in the inner loops.  I change that
by keeping tab myself of the sizes of the relevant lists in variables.

The effect was dramatic.  Here is the timing of the two runs I
reported before:

argument    before     after
very small    2250        20
small      1323640      1310 
large      forever     96710

I am not kidding - BTW, the timings in this case were little affected
by the profiling.

Thanks again for your help,


More information about the Forum mailing list