WEBINAR:
On-Demand
Application Security Testing: An Integral Part of DevOps

s we all know, premature optimization is considered evil as it often entails eventually useless design complications and
portability compromises. However, this doesn't mean that healthy programming habits should be completely ignored, especially when they are free of charge. This month's solution shows you an effective and simple technique that will help optimize the layout of your data structures (classes, structs, and unions) without sacrificing performance or incurring any design compromises. This technique is particularly useful in applications that manipulate a large number of objects, for example databases, CAD tools, directory services, graphical editors, and financial systems. It is also useful in memory-challenged environments such as embedded systems and mobile devices.

How to pack data members optimally so that memory isn't wasted and speed isn't lost?

Organize data members in a way that minimizes the amount of padding bytes inserted between them.