public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug pch/53880] [4.8 Regression] compile time regression when generating precompiled headers for boost
Date: Mon, 30 Jul 2012 13:52:00 -0000	[thread overview]
Message-ID: <bug-53880-4-HVDoyj15An@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53880-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53880

--- Comment #27 from Steven Bosscher <steven at gcc dot gnu.org> 2012-07-30 13:51:58 UTC ---
The problem is the quadratic behavior invoked by the loop in
gt_pch_nx_line_maps:
      {
        size_t l2 = (size_t)(((*x).info_macro).used);
        if ((*x).info_macro.maps != NULL) {
          size_t i2;
          for (i2 = 0; i2 != (size_t)(l2); i2++) {
            switch (((*x).info_macro.maps[i2]).reason == LC_ENTER_MACRO)
              {
              case 0:
                gt_pch_n_S ((*x).info_macro.maps[i2].d.ordinary.to_file);
                break;
              case 1:
                {
                  union tree_node * const x3 =
                    ((*x).info_macro.maps[i2].d.macro.macro) ?
HT_IDENT_TO_GCC_IDENT (HT_NODE (((*x).info_macro.maps[i2].d.macro.macro))) :
NULL;
                  gt_pch_n_9tree_node (x3);
                }
                if ((*x).info_macro.maps[i2].d.macro.macro_locations != NULL) {
                  gt_pch_note_object
((*x).info_macro.maps[i2].d.macro.macro_locations, x, gt_pch_p_9line_maps,
gt_types_enum_last);
                }
                break;
              default:
                break;
              }
          }

and the loop in gt_pch_p_9line_maps:

    size_t l2 = (size_t)(((*x).info_macro).used);
    if ((*x).info_macro.maps != NULL) {
      size_t i2;
      for (i2 = 0; i2 != (size_t)(l2); i2++) {
        switch (((*x).info_macro.maps[i2]).reason == LC_ENTER_MACRO)
          {
          case 0:
            if ((void *)((*x).info_macro.maps) == this_obj)
              op (&((*x).info_macro.maps[i2].d.ordinary.to_file), cookie);
            break;
          case 1:
            {
              union tree_node * x3 =
                ((*x).info_macro.maps[i2].d.macro.macro) ?
HT_IDENT_TO_GCC_IDENT (HT_NODE (((*x).info_macro.maps[i2].d.macro.macro))) :
NULL;
              if ((void *)((*x).info_macro.maps) == this_obj)
                op (&(x3), cookie);
              (*x).info_macro.maps[i2].d.macro.macro = (x3) ? CPP_HASHNODE
(GCC_IDENT_TO_HT_IDENT ((x3))) : NULL;
            }
            if ((*x).info_macro.maps[i2].d.macro.macro_locations != NULL) {
              if ((void *)((*x).info_macro.maps) == this_obj)
                op (&((*x).info_macro.maps[i2].d.macro.macro_locations),
cookie);
            }
            break;
          default:
            break;
          }
      }


The first loop registers every line map entry to be visited for pointer
rewriting later by gt_pch_p_9line_maps:

gt_pch_note_object ((*x).info_macro.maps[i2].d.macro.macro_locations, x,
gt_pch_p_9line_maps, gt_types_enum_last);

where x==input.c:line_table, and
(*x).info_macro.maps[i2].d.macro.macro_locations is the "i2"'th entry.

The second loop is called from the loop in gt_pch_save via note_ptr_fn, which
is gt_pch_p_9line_maps:

      state.ptrs[i]->note_ptr_fn (state.ptrs[i]->obj,
                                  state.ptrs[i]->note_ptr_cookie,
                                  relocate_ptrs, &state);
==
       gt_pch_p_9line_maps((*x).info_macro.maps[i2].d.macro.macro_locations,
                           &line_table, relocate_ptrs, &state);

and gt_pch_p_9line_maps loops over all map elements until:
  (void *)((*x).info_macro.maps) == this_obj

This causes (((*x).info_macro).used)**2 visits.


  parent reply	other threads:[~2012-07-30 13:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06 15:46 [Bug pch/53880] New: " markus at trippelsdorf dot de
2012-07-06 15:55 ` [Bug pch/53880] " markus at trippelsdorf dot de
2012-07-06 16:47 ` markus at trippelsdorf dot de
2012-07-08  7:08 ` markus at trippelsdorf dot de
2012-07-09  8:41 ` rguenth at gcc dot gnu.org
2012-07-23 13:46 ` paolo.carlini at oracle dot com
2012-07-23 21:29 ` steven at gcc dot gnu.org
2012-07-23 22:46 ` steven at gcc dot gnu.org
2012-07-24  6:50 ` markus at trippelsdorf dot de
2012-07-24  8:16 ` stevenb.gcc at gmail dot com
2012-07-24  9:20 ` steven at gcc dot gnu.org
2012-07-24  9:34 ` rguenth at gcc dot gnu.org
2012-07-24  9:41 ` stevenb.gcc at gmail dot com
2012-07-24  9:43 ` rguenth at gcc dot gnu.org
2012-07-24 10:03 ` stevenb.gcc at gmail dot com
2012-07-24 10:13 ` paolo.carlini at oracle dot com
2012-07-26 16:30 ` dodji at seketeli dot org
2012-07-26 17:15 ` dodji at seketeli dot org
2012-07-26 17:16 ` dodji at seketeli dot org
2012-07-26 17:16 ` dodji at seketeli dot org
2012-07-26 17:18 ` dodji at seketeli dot org
2012-07-26 19:45 ` stevenb.gcc at gmail dot com
2012-07-26 21:11 ` dodji at seketeli dot org
2012-07-30  9:11 ` steven at gcc dot gnu.org
2012-07-30 10:54 ` markus at trippelsdorf dot de
2012-07-30 11:08 ` steven at gcc dot gnu.org
2012-07-30 11:22 ` markus at trippelsdorf dot de
2012-07-30 12:03 ` steven at gcc dot gnu.org
2012-07-30 13:17 ` steven at gcc dot gnu.org
2012-07-30 13:52 ` steven at gcc dot gnu.org [this message]
2012-07-30 14:22 ` steven at gcc dot gnu.org
2012-07-30 15:04 ` steven at gcc dot gnu.org
2012-07-30 16:15 ` steven at gcc dot gnu.org
2012-07-30 16:26 ` markus at trippelsdorf dot de
2012-07-30 22:55 ` steven at gcc dot gnu.org
2012-07-31  9:21 ` steven at gcc dot gnu.org
2012-07-31  9:24 ` steven at gcc dot gnu.org
2012-07-31 10:36 ` markus at trippelsdorf dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53880-4-HVDoyj15An@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).