Ignore:
Timestamp:
Feb 1, 2015, 9:48:36 PM (10 years ago)
Author:
bird
Message:

Optimizations, tuning and bug fixes for the 'compiled' string expansion code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/variable.c

    r2770 r2771  
    449449  v->export = v_default;
    450450#ifdef CONFIG_WITH_COMPILER
     451  v->recursive_without_dollar = 0;
    451452  v->evalprog = 0;
    452453  v->expandprog = 0;
     
    617618      v->export = v_default;
    618619#ifdef CONFIG_WITH_COMPILER
     620      v->recursive_without_dollar = 0;
    619621      v->evalprog = 0;
    620622      v->expandprog = 0;
     
    28672869static unsigned long var_stats_expands, var_stats_expanded;
    28682870#endif
     2871#ifdef CONFIG_WITH_COMPILER
     2872static unsigned long var_stats_expandprogs, var_stats_evalprogs;
     2873#endif
    28692874#ifdef CONFIG_WITH_MAKE_STATS
    28702875static unsigned long var_stats_changes, var_stats_changed;
     
    29402945#if defined (CONFIG_WITH_COMPILER) || defined (CONFIG_WITH_MAKE_STATS)
    29412946  if (v->evalval_count != 0)
     2947    {
    29422948# ifdef CONFIG_WITH_MAKE_STATS
    2943     printf (_(", %u evalvals (%llu ticks)"), v->evalval_count, v->cTicksEvalVal);
     2949      printf (_(", %u evalvals (%llu ticks)"), v->evalval_count, v->cTicksEvalVal);
    29442950# else
    2945     printf (_(", %u evalvals"), v->evalval_count);
     2951      printf (_(", %u evalvals"), v->evalval_count);
    29462952# endif
     2953      var_stats_evalvaled++;
     2954    }
    29472955  var_stats_evalvals += v->evalval_count;
    2948   var_stats_evalvaled += (v->evalval_count != 0);
    29492956
    29502957  if (v->expand_count != 0)
    2951     printf (_(", %u expands"), v->expand_count);
     2958    {
     2959      printf (_(", %u expands"), v->expand_count);
     2960      var_stats_expanded++;
     2961    }
    29522962  var_stats_expands += v->expand_count;
    2953   var_stats_expanded += (v->expand_count != 0);
     2963
    29542964# ifdef CONFIG_WITH_COMPILER
    29552965  if (v->evalprog != 0)
    2956     printf (_(", evalprog"));
     2966    {
     2967      printf (_(", evalprog"));
     2968      var_stats_evalprogs++;
     2969    }
    29572970  if (v->expandprog != 0)
    2958     printf (_(", expandprog"));
     2971    {
     2972      printf (_(", expandprog"));
     2973      var_stats_expandprogs++;
     2974    }
    29592975# endif
    29602976#endif
     
    29622978#ifdef CONFIG_WITH_MAKE_STATS
    29632979  if (v->changes != 0)
    2964     printf (_(", %u changes"), v->changes);
     2980    {
     2981      printf (_(", %u changes"), v->changes);
     2982      var_stats_changed++;
     2983    }
    29652984  var_stats_changes += v->changes;
    2966   var_stats_changed += (v->changes != 0);
    29672985
    29682986  if (v->reallocs != 0)
    2969     printf (_(", %u reallocs"), v->reallocs);
     2987    {
     2988      printf (_(", %u reallocs"), v->reallocs);
     2989      var_stats_realloced++;
     2990    }
    29702991  var_stats_reallocs += v->reallocs;
    2971   var_stats_realloced += (v->reallocs != 0);
    29722992
    29732993  if (v->references != 0)
    2974     printf (_(", %u references"), v->references);
     2994    {
     2995      printf (_(", %u references"), v->references);
     2996      var_stats_referenced++;
     2997    }
    29752998  var_stats_references += v->references;
    2976   var_stats_referenced += (v->references != 0);
    29772999
    29783000  var_stats_val_len += v->value_length;
     
    30343056    = var_stats_evalvaled = 0;
    30353057#endif
     3058#ifdef CONFIG_WITH_COMPILER
     3059  var_stats_expandprogs = var_stats_evalprogs = 0;
     3060#endif
    30363061#ifdef CONFIG_WITH_MAKE_STATS
    30373062  var_stats_changes = var_stats_changed = var_stats_reallocs
     
    30883113               var_stats_expands);
    30893114#endif
     3115#ifdef CONFIG_WITH_COMPILER
     3116      if (var_stats_expandprogs || var_stats_evalprogs)
     3117        printf(_("#  eval progs %5lu (%2u%%),     expand progs %6lu (%2u%%)\n"),
     3118               var_stats_evalprogs,
     3119               (unsigned int)((100.0 * var_stats_evalprogs) / set->table.ht_fill),
     3120               var_stats_expandprogs,
     3121               (unsigned int)((100.0 * var_stats_expandprogs) / set->table.ht_fill));
     3122#endif
    30903123      }
    30913124
Note: See TracChangeset for help on using the changeset viewer.