Skip to content

Compile time scales non-linearly with number of fields in structs #299

Closed
@evnu

Description

@evnu

We are experiencing very long compile times for our crates when using rustlerwith --release mode. It appears that the compile time does scale superlinearly with the number of fields when using derives such as NifStruct. I implemented an example here. For the benchmark, I created some simple crates which contain only one struct using NifStruct and a number of simple fields.

Example run:

~/tools/rusty/native/benchmark_compile(master ✗) ./benchmark.sh
number_of_fields  time
0 0.03
1 0.24
2 0.27
4 0.54
8 1.76
16 9.11
32 60.81
48 156.27
64 407.51
~/tools/rusty/native/benchmark_compile(master ✗) ./plot.gpi

plot

For comparision, here are the results when using the debug mode:

plot

As expected, the compile time is much faster. It also appears to be more linear than with release mode. I suspect that we somehow make the life of LLVM harder w.r.t. the generated code.

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