Skip to content

Use bool bitfields to reduce struct sizes #1125

@bnoordhuis

Description

@bnoordhuis

Structs like JSFunctionDef have a ton of booleans and there can be a ton of JSFunctionDefs.

It was recently brought to our attention that, at least on powerpc, sizeof(bool) == 4, so there's probably a lot of unused space that can be reclaimed by switching from plain bool field to bool field : 1.

As an example: my rough estimate is that, with bool bitfields and some field reordering, we can shave 80 bytes off JSFunctionDef on powerpc and other platforms where sizeof(bool) > sizeof(char).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions