Skip to content

compilation is awfully slow #103

Description

@tamird

Hello! On my M3 Pro it takes 22 seconds to compile octorust (excluding dependencies). This timing seems insensitive to features (same result with default and --no-default-features).

I can't attach the HTML report generated by cargo build --timings -p octorust --no-default-features but here's a snippet:

Image

I tried profiling the compiler:

cargo install --git https://github.com/rust-lang/measureme summarize
cd github
cargo +nightly rustc -- -Z self-profile
summarize summarize ../octorust-*.mm_profdata | head -n11
+-------------------------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| Item                                                                    | Self time | % of total time | Time     | Item count | Incremental result hashing time |
+-------------------------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| LLVM_module_codegen_emit_obj                                            | 6.43s     | 19.772          | 6.43s    | 186        | 0.00ns                          |
+-------------------------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| typeck                                                                  | 4.77s     | 14.649          | 5.29s    | 30934      | 387.19ms                        |
+-------------------------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| mir_borrowck                                                            | 3.01s     | 9.260           | 5.76s    | 30934      | 3.85ms                          |
+-------------------------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+
| LLVM_passes                                                             | 1.59s     | 4.880           | 1.59s    | 1          | 0.00ns                          |
+-------------------------------------------------------------------------+-----------+-----------------+----------+------------+---------------------------------+

I don't find this particularly telling, but it's a start. Is it possible there's a lot of duplication in the generated code? I haven't looked deeply.

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