On Fri, Jul 20, 2012 at 11:02 AM, Steven Bosscher <stevenb....@gmail.com> wrote:
> On Thu, Jul 19, 2012 at 11:09 AM, Richard Guenther
> <richard.guent...@gmail.com> wrote:
>> Hmm, pp_flush looks like a lot more expensive compared to pp_newline
>> for example in
>>
>> @@ -74,7 +74,7 @@ maybe_init_pretty_print (FILE *file)
>>  static void
>>  newline_and_indent (pretty_printer *buffer, int spc)
>>  {
>> -  pp_newline (buffer);
>> +  pp_flush (buffer);
>>    INDENT (spc);
>>  }
>>
>> And I'm pretty sure that newline_and_indent callers that after it directly
>> dump to the stream should be fixed instead.  In fact, constant flushing
>> will just make things slow (yes, it's only dumping ...).
>
> Right, it's only dumping. I'm surprised one would care about its
> performance. And the patch actually helps in the debugger also: if for
> some reason a piece of invalid gimple is encountered then at least the
> part that was OK is still dumped. But oh well :-)
>
> I will need this additional patch to avoid test suite failures:
>
> Index: pretty-print.c
> ===================================================================
> --- pretty-print.c      (revision 189705)
> +++ pretty-print.c      (working copy)
> @@ -759,6 +759,7 @@ void
>  pp_base_newline (pretty_printer *pp)
>  {
>    obstack_1grow (pp->buffer->obstack, '\n');
> +  pp_needs_newline (pp) = false;
>    pp->buffer->line_length = 0;
>  }
>
> I suppose that's OK?

Yes.

Thanks,
Richard.

> Ciao!
> Steven

Reply via email to