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: [RFA 09/11] Use std::set in mi-main.c


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


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