Question on avoiding page faults

B

benben

Is there a standard guidline to avoid or minimize page faults when
manipulating data collections in C++?

ben
 
V

Victor Bazarov

benben said:
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
 
M

msalters

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
 
B

benben

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.

Yes! I meant how to minimize page 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

Thank you for that!
ben
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top