Hello Dimitrios,

I cannot approve or deny your patch, but I have one question.

[...]


> 2012-06-04  Dimitrios Apostolou <ji...@gmx.net>
> 
>       * line-map.c (linemap_enter_macro): Don't zero max_column_hint in
>       every macro. This improves performance by reducing the number of
>       reallocations when track-macro-expansion is on.

[...]

> === modified file 'libcpp/line-map.c'

[...]

> @@ -331,7 +331,6 @@ linemap_enter_macro (struct line_maps *s
>         num_tokens * sizeof (source_location));
>  
>    LINEMAPS_MACRO_CACHE (set) = LINEMAPS_MACRO_USED (set) - 1;
> -  set->max_column_hint = 0;

I am wondering why this change implies better performance.

Is this because when we later want to encode a new line/column, and
hit the spot below, (in linemap_line_start via
linemap_position_for_column), we call less linemap_add (and thus
allocate less maps):

      if (line_delta < 0
          || last_line != ORDINARY_MAP_STARTING_LINE_NUMBER (map)
          || SOURCE_COLUMN (map, highest) >= (1U << column_bits))
        map = (struct line_map *) linemap_add (set, LC_RENAME,
                                               ORDINARY_MAP_IN_SYSTEM_HEADER_P
                                               (map),
                                               ORDINARY_MAP_FILE_NAME (map),
                                               to_line);

The reason why the "if" would fail more, is that the condition

    "SOURCE_COLUMN (map, highest) >= (1U << column_bits)

would condition would fail more often, because the column_bits would
be smaller more often.

Does that match your measurements?

Thanks.

-- 
                Dodji

Reply via email to