Skip to content

gen-arbitrary is slow #111

@Ekleog

Description

@Ekleog

Hey! So I recently tried deriving TypeGenerator with a reasonably small type.

Basically, this was like using bolero::check!().with_type::<Vec<(#[gen_arbitrary()] Uuid, String, String)>>().

Turns out just doing this led to the test taking more time than I would wait just to generate the first input (I bisected with a panic!() and ended up at the top of the check, because I was convinced I had a deadlock somewhere). perf confirms, almost all the time was being spent in generating Strings.

Sure this was using cargo test, so without optimizations on. But still, maybe it'd make sense to have the default TypeGenerator for basic types be somewhat limited in size, so they don't literally take minutes to generate with relatively simple types? (I must say I have not tried actually profiling when fuzzing yet, so I don't know how badly this affects fuzzers yet, but for tests not using gen_with basically made the generated code impossible-to-use)

Metadata

Metadata

Assignees

No one assigned

    Labels

    [E] PerformanceTrack performance improvement (Time / Memory / CPU)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions