← Back to team overview

maria-developers team mailing list archive

Re: 16e38888c06: Improved storage size for Item, Field and some other classes


Hi, Michael!

Did you consider trying -Wpadded?

     Warn if padding is included in a structure, either to align an
     element of the structure or to align the whole structure.
     Sometimes when this happens it is possible to rearrange the fields
     of the structure to reduce the padding and so make the structure

Might reveal more useful cases where fields could be rearranged.

On Mar 27, Michael Widenius wrote:
> revision-id: 16e38888c06 (mariadb-10.5.2-513-g16e38888c06)
> parent(s): 4cfb680b685
> author: Michael Widenius <michael.widenius@xxxxxxxxx>
> committer: Michael Widenius <michael.widenius@xxxxxxxxx>
> timestamp: 2021-03-24 14:31:53 +0200
> message:
> Improved storage size for Item, Field and some other classes
> - Changed order of class fields to remove dead alignment space.
> - Changed bool fields in Item to bit fields.
> - Used packed enum's for some fields in common classes
> - Removed not used Item::rsize.
> - Changed some class variables from uint/int to smaller type int's.
> - Ensured that field_index is uint16 in all classes and functions. Fixed
>   also that we proparly compare with NO_CACHED_FIELD_INDEX when checking
>   if variable is not set.
> - Removed checking of highest bit of unireg_check (has not been used in
>   a long time)
> - Fixed wrong arguments to make_cond_for_table() for join_tab_idx_arg
>   from false to 0.
> One of the result was reducing the size if class Item with ~24 bytes

VP of MariaDB Server Engineering
and security@xxxxxxxxxxx

Follow ups