[RFA 09/11] Use std::set in mi-main.c
Pedro Alves
palves@redhat.com
Thu Sep 28 10:10:00 GMT 2017
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
More information about the Gdb-patches
mailing list