This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 09/11] Use std::set in mi-main.c
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Thu, 28 Sep 2017 11:10:51 +0100
- Subject: Re: [RFA 09/11] Use std::set in mi-main.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2E8A3C1881
- References: <20170912185736.20436-1-tom@tromey.com> <20170912185736.20436-10-tom@tromey.com>
On 09/12/2017 07:57 PM, Tom Tromey wrote:
> Change a couple of spots in mi-main.c to use std::set. This
> simplifies the code and removes some cleanups.
std::set always gives me pause. For small objects like int,
and when the use case is insertion phase + lookup phase + discard set,
unsorted inserting into a vector, sorting, and then binary searching
the vector for lookuups is very likely to have better performance, for
cache locality reasons, and also because fewer allocations (with
std::set being a node-based container...)
But it's likely that in this case it doesn't really matter, so let's
go with the simplicity argument.
(At some point I may propose some data structure on top of
std::vector for use cases like this.)
Patch is OK as is.
Thanks,
Pedro Alves