Victor Bazarov wrote:
benben wrote: Is there a standard guidline to avoid or minimize page faults when
manipulating data collections in C++?
Stay away from bare pointers and dynamic memory management.
V
Eh? That avoids the undefined-behavior page faults. You
don't want to minimize those, elimination is the only
reasonable goal. The term "minimize" suggests to me he
refers to those page faults that cause swapping.
In that case, you're worried about data locality and
limiting memory use. That's not directly C++ related,
although C++ techniques like Small-String optimalization
are invented for just that purpose.
Other methods involve replacing owning pointers in objects
by the objects pointed to (e.g. undoing the pimpl idiom,
which trades runtime performance for compile time) and
using smaller data types like float/short.
HTH,
Michiel Salters