Well, this increases encapsulation, since your header file now contains only public elements and a single pointer to a private implementation.
It also (slightly?) Reduces performance due to an additional level of indirection.
"Reducing compilation time" is a key issue here.
If you (your company) are the only users of the class, then I do not think that you have a reason to use this idiom. You get lower performance, and in any case, you should have daily (or periodic) modifications to the source code (which should be aware of dependencies between classes).
This means that compilation time should be pretty much irrelevant if you are the only consumer of the class.
If you distribute the library, the story is completely different. Changes to the headers mean that any customers you have will need to rebuild their applications to use their new version, even if what you did change the personal parts of the class. Using the pimpl idiom here would mean that the change is invisible to users of your dynamic library.
source share