B
benben
Is there a standard guidline to avoid or minimize page faults when
manipulating data collections in C++?
ben
manipulating data collections in C++?
ben
benben said:Is there a standard guidline to avoid or minimize page faults when
manipulating data collections in C++?
Victor said: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
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.