Hello, I noticed that the Glyph struct was using more memory than was
needed. Considering that the fg and bg colors have values that are
always in the range of [0, 255], there is no need to use a uint32_t
for them. A single byte each would suffice. Furthermore, assuming
default alignment and packing rules for most target architectures,
there was an additional two padding bytes being inserted in between
the `mode' and `fg' fields.
The following patch reduces the size of Glyph from 16 bytes to 8 bytes.
On a terminal with 240 columns and 124 rows, between both the primary
and alternate line buffers, total memory savings are:
2 * 8 * 240 * 124 = 476160 bytes
Received on Wed Apr 22 2015 - 00:57:07 CEST