This is the mail archive of the
mailing list for the GCC project.
Re: C++ ping: reduce size of cp_token
On Tue, Mar 25, 2008 at 8:09 PM, Tom Tromey <email@example.com> wrote:
> >>>>> "Mark" == Mark Mitchell <firstname.lastname@example.org> writes:
> Mark> This patch certainly looks like it should help, because making
> Mark> tokens smaller should save memory, and we know GCC performance
> Mark> is memory-sensitive. However, it's always nice to measure.
> Mark> I'll pre-approve the patch if you do some plausible measurement of
> Mark> your choice that shows that this makes things no worse.
> I looked into this. I rebuilt libstdc++ a number of times both with
> and without the patch.
> The memory saved by this patch is completely swamped by the memory
> wasted due to the buffer reallocation approach in cp_lexer_new_main.
> I instrumented this function to print the amount of memory being used.
> For smallish compilation units, the default buffer is not filled.
> Resizing the buffer also often yields a lot of wasted space.
> So, consider this patch withdrawn. There's no point to it unless the
> greater part is dealt with. FWIW it did not seem to have any
> measurable effect on compilation time.
It is IMHO good to keep structs small, even if there happens to be no
visible effect of doing so. So please do not withdraw it as the patch
does the right thing ;)