[GAP Forum] Mystry call to Order

Arnaldo Mandel am at ime.usp.br
Wed Jul 16 15:12:19 BST 2008


Hi everybody,

After struggling with a very slow running function, I was met with a
mystery.  Here is profiling data:

gap> ProfileOperationsAndMethods(true);
gap> ProfileGlobalFunctions( true );
gap> DisplayProfile();
  count  self/ms  chld/ms  function                                           
  16902        0        0  ADD_LIST                                           
              10           TOTAL                                              
gap> x4:=Complete(BFST[4]);;   
gap> time;
2250
gap> DisplayProfile();          
  count  self/ms  chld/ms  function                                           
  13694        0        0  Size: for a list that is a collection              
  23967        0        0  ADD_LIST                                           
   4229     2220        0  Order: for a group                                 
            2260           TOTAL                                              
gap> x5:=Complete(BFST[5]);;
gap> time;
1323640
gap> DisplayProfile();          
  count  self/ms  chld/ms  function                                           
  13737       10        0  WriteAll: output text file                         
  18332       30       10  WriteAll                                           
  12942       20       20  Concatenation                                      
  43325       40       10  Enumerator: for a collection that is a list        
   6471       30       50  String: for an object, and a positive integer      
  12942        0       90  String                                             
 162543       90       10  APPEND_LIST                                        
 316529       80       30  Size: for a list that is a collection              
 167708      130        0  Remove: two arguments, fast                        
 209192      240       10  SHALLOW_COPY_OBJ: for a presentation in default *  
      2       50      200  Perform                                            
  43325      260        0  SSortedList: for a plist                           
 167708      270      130  Remove                                             
 226094      490      -10  ADD_LIST                                           
  43325      240      300  AsSSortedList: for a plist                         
  43325      180      550  Enumerator: for a collection with known `AsSSort*  
  94236  1322830       80  Order: for a group                                 
         1325010           TOTAL                                              

As you can see, Order takes up all the time.  However, Complete does
not involve any group.  Its argument is a list of small matrices, and
the return value is of the same type.  In between, several new
matrices are created; each new matrix is a StructuralCopy of an
existing one, followed by some simple modifications.  Functions that are
explicitly called are: Size(list), StructuralCopy, Append, Add, Remove,
AsSet(small list of integers), Print, RemInt, String(integer,integer).

So, who is calling Order?

am

-- 
Arnaldo Mandel                        
Departamento de Ciência da Computação - Computer Science Department
Universidade de São Paulo, Bra[sz]il	  
am at ime.usp.br
Talvez você seja um Bright http://the-brights.net Maybe you are a Bright.



More information about the Forum mailing list