Ticket #23: arend_7_5.5-profile-matcher.diff

File arend_7_5.5-profile-matcher.diff, 3.4 kB (added by arend, 3 years ago)

Patch

  • engine/matchpat.c

    RCS file: /cvsroot/gnugo/gnugo/engine/matchpat.c,v
    retrieving revision 1.68
    diff -u -p -r1.68 matchpat.c
     
    3636/* Pattern profiling functions:                                           */ 
    3737/**************************************************************************/ 
    3838 
    39 /* define this to see how each phase of pattern rejection is performing */ 
    40 /* #define PROFILE_MATCHER */ 
    41  
    42  
    43 #ifdef PROFILE_MATCHER 
    44 static int totals[6]; 
    45 #endif 
    46  
    4739 
    4840#if PROFILE_PATTERNS 
    4941/* Initialize pattern profiling fields in one pattern struct array. */ 
     
    382374       */ 
    383375 
    384376      if (anchor_test != pattern->anchored_at_X) 
    385       { 
    386 #ifdef PROFILE_MATCHER 
    387         /* oops - need to work out something we deferred */ 
    388         totals[0] += (pattern->trfno == 5 ? 4 : pattern->trfno); 
    389 #endif 
    390377        continue;  /* does not match the anchor */ 
    391       } 
    392378 
    393379      ll = 0;  /* first transformation number */ 
    394380      end_transformation = pattern->trfno; 
     
    399385        end_transformation = 6; 
    400386      } 
    401387       
    402 #ifdef PROFILE_MATCHER 
    403       totals[0] += end_transformation - ll; 
    404 #endif 
    405  
    406388      /* try each orientation transformation. Assume at least 1 */ 
    407389 
    408390      do { 
     
    411393        int nodes_before; 
    412394#endif 
    413395         
    414 #ifdef PROFILE_MATCHER 
    415         ++totals[1]; 
    416 #endif 
    417  
    418396#if GRID_OPT == 1 
    419397 
    420398        /* We first perform the grid check : this checks up to 16 
     
    432410 
    433411#endif /* GRID_OPT == 1 */ 
    434412 
    435 #ifdef PROFILE_MATCHER 
    436         ++totals[2]; 
    437 #endif 
    438413        /* Next, we do the range check. This applies the edge 
    439414         * constraints implicitly. 
    440415         */ 
     
    460435            continue;  /* out of range */ 
    461436        } 
    462437 
    463 #ifdef PROFILE_MATCHER    
    464         ++totals[3]; 
    465 #endif 
    466  
    467438        /* Now iterate over the elements of the pattern. */ 
    468439        found_goal = 0; 
    469440        for (k = 0; k < pattern->patlen; ++k) { /* match each point */ 
     
    502473#endif /* we don't trust the grid optimisation */ 
    503474 
    504475 
    505 #ifdef PROFILE_MATCHER 
    506         ++totals[4]; 
    507 #endif 
    508  
    509476        /* Make it here ==> We have matched all the elements to the board. */ 
    510477        if ((goal != NULL) && !found_goal) 
    511478          goto match_failed; 
    512479 
    513 #ifdef PROFILE_MATCHER 
    514         ++totals[5]; 
    515 #endif 
    516  
    517480#if PROFILE_PATTERNS 
    518481        pattern->hits++; 
    519482        nodes_before = stats.nodes; 
     
    535498      } while (++ll < end_transformation); /* ll loop over symmetries */ 
    536499    } /* if not rejected by maxwt */ 
    537500  } while ((++pattern)->patn);  /* loop over patterns */ 
    538  
    539  
    540 #ifdef PROFILE_MATCHER 
    541   fprintf(stderr,  
    542           "total %d, anchor=%d, grid=%d, edge=%d, matched=%d, accepted=%d\n", 
    543           totals[0], totals[1], totals[2], totals[3], totals[4], totals[5]); 
    544 #endif 
    545  
    546501} 
    547502 
    548503 
     
    976931  int nodes_before; 
    977932#endif 
    978933   
    979 #ifdef PROFILE_MATCHER 
    980   ++totals[1]; 
    981 #endif 
    982  
    983934  if (0) 
    984935    gprintf("check_pattern_light @ %1m rot:%d pattern: %s\n",  
    985936            anchor, ll, pattern->name); 
     
    1023974    if (goal != NULL && !found_goal) 
    1024975      goto match_failed; 
    1025976  } 
    1026  
    1027 #ifdef PROFILE_MATCHER 
    1028   ++totals[4]; 
    1029 #endif 
    1030977 
    1031978#if PROFILE_PATTERNS 
    1032979  pattern->hits++;