Re: [RFA 09/11] Use std::set in mi-main.c

Pedro Alves
2017-09-28T10:10:56Z

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