Skip to content

TargetSurfaces Pahole suggestions

According to pahole changing to

/* Final reorganized struct: */
class TargetSurfaces {
	bool                       m_orderTrue;          /*     0     1 */
	bool                       m_flipDirection;      /*     1     1 */
	bool                       m_absDist;            /*     2     1 */
	bool                       m_debugMode;          /*     3     1 */
	float                      m_tolerance;          /*     4     4 */
	TargetSurfaceVector        m_baseSurfaces;       /*     8    24 */
	class vector<std::vector<Trk::TargetSurface, std::allocator<Trk::TargetSurface> >, std::allocator<std::vector<Trk::TargetSurface, std::allocator<Trk::TargetSurface> > > > m_tempSurfaces; /*    32    24 */
	TargetSurfaceVector        m_ordered;            /*    56    24 */
	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
	Vector3D                   m_probePos;           /*    80    24 */
	Vector3D                   m_probeDir;           /*   104    24 */
	/* --- cacheline 2 boundary (128 bytes) --- */
	unsigned int               m_numAlongPath;       /*   128     4 */
	int                        m_nextSf;             /*   132     4 */
	double                     m_distanceToNext;     /*   136     8 */
	double                     m_lastStep;           /*   144     8 */
	double                     m_flipDistance;       /*   152     8 */
	const class TrackingVolume  * m_currentFrame;    /*   160     8 */
	const class TrackingVolume  * m_currentDense;    /*   168     8 */

	/* size: 176, cachelines: 3, members: 17 */
	/* last cacheline: 48 bytes */
};   /* saved 24 bytes and 1 cacheline! */

from

class TargetSurfaces {
	bool                       m_orderTrue;          /*     0     1 */

	/* XXX 7 bytes hole, try to pack */

	TargetSurfaceVector        m_baseSurfaces;       /*     8    24 */
	class vector<std::vector<Trk::TargetSurface, std::allocator<Trk::TargetSurface> >, std::allocator<std::vector<Trk::TargetSurface, std::allocator<Trk::TargetSurface> > > > m_tempSurfaces; /*    32    24 */
	TargetSurfaceVector        m_ordered;            /*    56    24 */
	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
	float                      m_tolerance;          /*    80     4 */

	/* XXX 4 bytes hole, try to pack */

	Vector3D                   m_probePos;           /*    88    24 */
	Vector3D                   m_probeDir;           /*   112    24 */
	/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
	unsigned int               m_numAlongPath;       /*   136     4 */
	int                        m_nextSf;             /*   140     4 */
	double                     m_distanceToNext;     /*   144     8 */
	double                     m_lastStep;           /*   152     8 */
	bool                       m_flipDirection;      /*   160     1 */

	/* XXX 7 bytes hole, try to pack */

	double                     m_flipDistance;       /*   168     8 */
	const class TrackingVolume  * m_currentFrame;    /*   176     8 */
	const class TrackingVolume  * m_currentDense;    /*   184     8 */
	/* --- cacheline 3 boundary (192 bytes) --- */
	bool                       m_debugMode;          /*   192     1 */
	bool                       m_absDist;            /*   193     1 */
public:


	/* size: 200, cachelines: 4, members: 17 */
	/* sum members: 176, holes: 3, sum holes: 18 */
	/* padding: 6 */
	/* last cacheline: 8 bytes */
};

saves us a cacheline

Merge request reports