[dev] [st] [PATCH] Optimize memory footprint of line buffers

From: suigin <suigin_AT_national.shitposting.agency>
Date: Tue, 21 Apr 2015 15:57:07 -0700

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

This archive was generated by hypermail 2.3.0 : Tue Apr 21 2015 - 17:00:11 CEST