This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpplib: minor performance improvement


This also looks OK.....

Dave

Zack Weinberg wrote:

> cppmain calls fwrite() for every token, which adds up to quite a bit
> of overhead.  read_and_prescan in cppfiles.c allocates and initializes
> a large buffer and a medium-sized table on the stack.  This patch
> corrects both these problems.  It's good for about 3% off the total
> time for a libc compile:
>
> before  1:43:40 - 5067.41 user, 536.86 system, 90% cpu
> after   1:41:24 - 4945.57 user, 552.20 system, 90% cpu
>
> I am not sure why the system time goes up.
>
> zw
>
> 1999-05-08 22:19 -0400  Zack Weinberg  <zack@rabi.columbia.edu>
>
>         * cppfiles.c (initialize_input_buffer): New function.
>         (finclude): Call it, if pfile->input_buffer is NULL.  Accept
>         any character device as an input file.
>         (read_and_prescan): Use pfile->input_buffer and
>         pfile->input_speccase.
>         * cppinit.c (cpp_cleanup): Free pfile->input_buffer and
>         pfile->input_speccase.
>         * cpplib.h (cpp_reader): Add input_buffer, input_speccase, and
>         input_buffer_len members.  Use memcpy in CPP_PUTS_Q.
>
>         * cppmain.c: Buffer output in the token_buffer; throttle
>         number of calls to fwrite; check for errors from fwrite.
>




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]