This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v5] C++ify gdb/common/environ.c
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>, Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Mon, 19 Jun 2017 13:13:06 +0100
- Subject: Re: [PATCH v5] C++ify gdb/common/environ.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E161D80460
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E161D80460
- References: <20170413040455.23996-1-sergiodj@redhat.com> <20170616222315.12779-1-sergiodj@redhat.com> <4e43c71a2ac4aa229bb262e18dec668c@polymtl.ca>
On 06/17/2017 09:54 AM, Simon Marchi wrote:
> I actually preferred the option of adding the NULL element to the vector
> in the gdb_environ constructor, since it allows always having the vector
> in a consistent state. I don't think that avoiding that heap allocation
> is worth the complexity it adds to the code (unless we can prove
> otherwise by memory usage profiling).
I'm not exactly sure what complexity this is, but I'm not going to
strongly object to always putting in the NULL element, since that's
what we currently do today. This shows we're missing unit test coverage
at least.
I was going to write something longish about premature pessimization,
and on how that in my experience is really a mindset that ends up causing
us to leave a bunch of easy optimizations that all adding up, do matter
significantly, coming from actually running perf against gdb and seeing
the sometimes quite silly hot spots that could have been easily
avoided. However, I found this article, and I find that it mirrors
perfectly my view, and is much better written than what I was going to say:
http://www.bornsleepy.com/2014/10/27/premature-pessimization-and-the-like.html
I fully subscribe to the above.
Thanks,
Pedro Alves