This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v5] C++ify gdb/common/environ.c


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


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