Relative Content

Tag Archive for c++optimizationheader-files

Reduction of memory consumption in C++

I am writing a header file on C++ that implements interaction with quaternion. Quaternion can be interpreted as a + bi + cj + dk, so its components are stored in m_value in b, c, d, a order. I also support representing a quaternion as a scalar-vector. I’ve noticed that in method updateComponents() I use 2x more memory than I actually need. How can I fix that? m_value and scalar-vector representation are required.