Skip to content

Add --json=timings option to print build timings #873

Open
@Kobzol

Description

@Kobzol

Proposal

I would like to add new a option to the --json compiler flag, called e.g. timings, which would print a JSON message with a very high-level overview of the time spent in individual sections of the compilation (e.g. frontend/backend/debuginfo generation/linking). This information could be then processed e.g. by Cargo and displayed in cargo build --timings (rust-lang/cargo#14265, rust-lang/cargo#10643), to help Rust users more easily diagnose where is the bottleneck in their compilation pipeline.

In terms of implementation, I'm imagining a very slimmed down version of -Zself-profile that is very cheap. Essentially just wrap the frontend/backend/linker sections of the compiler and output their wall-time duration.

Mentors or Reviewers

@Mark-Simulacrum

Process

The main points of the Major Change Process are as follows:

  • File an issue describing the proposal.
  • A compiler team member or contributor who is knowledgeable in the area can second by writing @rustbot second.
    • Finding a "second" suffices for internal changes. If however, you are proposing a new public-facing feature, such as a -C flag, then full team check-off is required.
    • Compiler team members can initiate a check-off via @rfcbot fcp merge on either the MCP or the PR.
  • Once an MCP is seconded, the Final Comment Period begins. If no objections are raised after 10 days, the MCP is considered approved.

You can read more about Major Change Proposals on forge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerAdd this label so rfcbot knows to poll the compiler teamfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementmajor-changeA proposal to make a major change to rustcto-announceAnnounce this issue on triage meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions