Re: [RFA 26/42] Remove free_pendings

Simon Marchi
2018-07-10T03:16:44Z

On 2018-07-09 10:55 PM, Simon Marchi wrote:
> On 2018-05-23 12:58 AM, Tom Tromey wrote:
>> buildsym.c currently keeps a free list of "struct pending"s. However,
>> this didn't seem necessary to me, and so this patch removes the free
>> list.
>
> LGTM.
>
> It looks like this was to avoid some allocations/deallocations, for performance?
> Since it's hard to tell if something is worth it performance-wise without data,
> I made some quick measurements. I compiled GDB with optimizations, then loaded
> my debug build of GDB in it like this:
>
> $ for i in 1 2 3; do /usr/bin/time -a -o after ./gdb /home/simark/build/binutils-gdb/gdb/gdb -readnow -batch; done
>
> This is before:
>
> 58.66user 5.38system 1:04.47elapsed 99%CPU (0avgtext+0avgdata 2841916maxresident)k
> 2520inputs+0outputs (1major+679737minor)pagefaults 0swaps
> 59.24user 5.52system 1:05.07elapsed 99%CPU (0avgtext+0avgdata 2841572maxresident)k
> 1616inputs+0outputs (4major+679723minor)pagefaults 0swaps
> 61.50user 5.38system 1:07.36elapsed 99%CPU (0avgtext+0avgdata 2841764maxresident)k
> 0inputs+0outputs (0major+679732minor)pagefaults 0swaps
>
> This is after:
>
> 53.14user 4.91system 0:59.02elapsed 98%CPU (0avgtext+0avgdata 2841824maxresident)k
> 0inputs+0outputs (0major+679713minor)pagefaults 0swaps
> 52.70user 4.97system 0:58.49elapsed 98%CPU (0avgtext+0avgdata 2842052maxresident)k
> 0inputs+0outputs (0major+679747minor)pagefaults 0swaps
> 54.42user 5.30system 1:01.11elapsed 97%CPU (0avgtext+0avgdata 2841764maxresident)k
> 0inputs+0outputs (0major+679760minor)pagefaults 0swaps
>
> So, unless I mixed up "before" and "after", it looks like this patch actually
> improves the performance of GDB!
>
> Simon

Ok, now that I re-run it I don't see a difference anymore... not sure what happened.
Still, the patch LGTM :)

Simon