packed_struct.rs icon indicating copy to clipboard operation
packed_struct.rs copied to clipboard

Long compile times for structs with large arrays

Open jkorinth opened this issue 1 year ago • 4 comments

Using a large array in a struct causes compile times to explode:

use packed_struct::prelude::*;

#[derive(PackedStruct)]
#[packed_struct(endian = "msb")]
pub struct MyStruct {
    x: u16,
    y: u16,
    d: [u16; 20000],
}

fn main() {}

I've tried analyzing with cargo b --timings but that didn't yield anything interesting. Let me know if I can help investigate.

jkorinth avatar Jul 11 '24 06:07 jkorinth

Any update on this? @rudib

jkorinth avatar Jul 30 '24 08:07 jkorinth

related to #102 Unfortunately project looks dead.

geovex avatar Sep 11 '24 23:09 geovex

@geovex Is it worth forking? I like working with it very much, but I'm not sure if there's a better alternative that everyone else is using instead?

jkorinth avatar Oct 31 '24 06:10 jkorinth

@jkorinth I've used: binary_layout (has nice concept of View over &[u8] but lacks bitfields) bitfield (unusual but extensive syntax, however I don't know if it can extract slices)

I'm still looking for some useful combination of those.

geovex avatar Oct 31 '24 19:10 geovex