public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: FX Coudert <fxcoudert@gmail.com>
To: "Tobias Schlüter" <tobias.schlueter@physik.uni-muenchen.de>
Cc: "fortran@gcc.gnu.org List" <fortran@gcc.gnu.org>,
	 gcc-patches list <gcc-patches@gcc.gnu.org>
Subject: Re: [fortran,patch] Don't write common more than once in a module file (PR 30285)
Date: Sat, 17 Nov 2007 13:46:00 -0000	[thread overview]
Message-ID: <F7B8D403-B274-4E0A-AF60-29ED89CAB022@gmail.com> (raw)
In-Reply-To: <4735D4C2.6050102@physik.uni-muenchen.de>

> Please call the variable written_commons, otherwise the name  
> written_common is overloaded with different meanings.

OK.

>> +  /* Check if we've already output this common.  */
>> +  for (w = written_common; w; w = w->next)
>> +    if (strcmp (w->name, name) == 0 && strcmp (w->label, label)  
>> == 0)
>> +      return;
>
> This is quadratic in the numbers of commons in a module.  Please  
> make written_common a balanced tree (such as our BBT_HEADER &  
> associates, this would leave us with O(N log(N)) complexity) or a  
> hashtable (leaving us with O(N) or something like that).

Hum... Don't hurt me, I'm a mere chemist! :)

I'll look into it, and post an updated patch. Until then, though:

> A non-algorithmic speedup would be comparing the pointers directly,  
> since as they are allocated strings they're guaranteed to be  
> different strings if they point to different locations.

Hum, they're static buffers actually, so I don't think I can do that,  
unfortunately :(

typedef struct gfc_common_head
{
   locus where;
   char use_assoc, saved, threadprivate;
   char name[GFC_MAX_SYMBOL_LEN + 1];
   struct gfc_symbol *head;
   char binding_label[GFC_MAX_BINDING_LABEL_LEN + 1];
   int is_bind_c;
}
gfc_common_head;


Thanks,
FX

  reply	other threads:[~2007-11-17  0:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-10 15:56 FX Coudert
2007-11-10 18:34 ` Tobias Schlüter
2007-11-17 13:46   ` FX Coudert [this message]
2007-11-17 13:47     ` FX Coudert
2007-11-17 16:33     ` Tobias Schlüter
2007-11-17 17:22       ` Tobias Schlüter
2007-11-17 17:38         ` FX Coudert
2007-11-12  9:52 ` Jerry DeLisle

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=F7B8D403-B274-4E0A-AF60-29ED89CAB022@gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias.schlueter@physik.uni-muenchen.de \
    /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).