This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Reduce size footprint of empty strings.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Cc: Maxim Kuvyrkov <maxim at codesourcery dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 25 Feb 2010 12:29:12 +0100
- Subject: Re: [PATCH] Reduce size footprint of empty strings.
- References: <4B8656D9.8050303@codesourcery.com> <571f6b511002250309p336063ccrb02fc983fc584ea6@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Feb 25, 2010 at 12:09:46PM +0100, Steven Bosscher wrote:
> On Thu, Feb 25, 2010 at 11:54 AM, Maxim Kuvyrkov <maxim@codesourcery.com> wrote:
>
> > OK for 4.6?
> >
> > The patch is simple enough to be considered for 4.5, but this is RMs' call.
>
> It may add some compile time if we loop over all string literals.
> Perhaps gcc can detect empty strings earlier (during parsing?) and
> hijack a flag on STRING_CST nodes?
The loop ends whenever we hit a non-'\0' char. And, for
char a[100000] = "\0\0";
the STRING_CST length is 3, not 100000. So it is going to add compile time
only for cases where you have extremely long strings full of
"\0\0\0\0\0\0..."s, something that is really not very common.
Jakub