Skip to content

using bit vector instead of Vec<bool> and enum compression #79

@fereidani

Description

@fereidani

Hi,
Congratualtion first, You have a great project here and I'm a big fan for a while now!
I like to contribute to this project but before sending you PR I wanted to see if you are interested in such changes or not.

I noticed that soa-derive is using Vec<bool> for bool, which can be replaced with a bit vector for better cpu cache performance with crates like https://crates.io/crates/bitvec or https://crates.io/crates/bit-vec.
It can reduce memory usage by 8x for bool and improve performance by improving cpu cache hits.

Other possible improvement is simple enums (without holding values) can be reduced to bit for example:

enum IsOk{
    Ok,
    NotOk,
}

this can be stored as bool which can use same bit vector treatment.
and this idea can scale to u8, u16(or maybe u2 u3 u4 u5 u6 u7 encodings).

Please let me know you think about these possible changes.

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