rust-lang / rust-lang/rust

Compiling serde_json deserialization for a wide struct scales nonlinearly for the Windows MSVC target

Open
#162,283 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-compiletime needs-triage O-windows T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

#[derive(serde::Deserialize)]
pub struct Wide {
    pub field_0000: String,
    // The reproduction generates N fields with this shape.
    pub field_0127: String,
}

#[inline(never)]
pub fn parse(input: &str) -> Result<Wide, serde_json::Error> {
    serde_json::from_str(input)
}

Complete reproduction: https://github.com/ashi009/rust-windows-serde-licm-repro

Run:

rustup target add x86_64-pc-windows-msvc --toolchain 1.98.0
python3 repro.py --bench

The script builds the same crate for x86_64-pc-windows-msvc at several field counts. It warms the dependency artifacts before starting the measurements. The crate produces only an rlib, so the reproduction does not require a Windows linker and can also be run from macOS or Linux.

I expected compile time to grow roughly in proportion to the number of fields.

Instead, a run on GitHub's windows-latest runner produced:

fields wall time
16 1.326 s
32 2.408 s
64 8.090 s
96 24.690 s
128 62.731 s

The number of fields increased by 8x while compile time increased by 47x. Doubling from 64 to 128 fields increased compile time by 7.8x.

Workflow run: https://github.com/ashi009/rust-windows-serde-licm-repro/actions/runs/33846253725

The behavior is also present on the current nightly. Cross-compiling the same
crate from macOS to x86_64-pc-windows-msvc produced:

fields wall time
16 0.339 s
32 0.630 s
64 2.170 s
96 5.872 s
128 12.146 s

That run used rustc 1.100.0-nightly (a69a63265 2026-09-03) with LLVM 23.1.1.

Compiler-level measurements and the tested LLVM-side mitigation are documented at https://github.com/ashi009/rust-windows-serde-licm-repro/blob/main/EVIDENCE.md.

Meta
rustc 1.98.0 (88d9e12ae 2026-08-18)
binary: rustc
commit-hash: 88d9e12ae178fab0fb5cc050a94da85685d449ea
commit-date: 2026-08-18
host: x86_64-pc-windows-msvc
release: 1.98.0
LLVM version: 22.1.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running rustup target add x86_64-pc-windows-msvc and python3 repro.py --bench from the linked reproduction. Read EVIDENCE.md for the compiler-level measurements and tested LLVM-side mitigation. Done means addressing the nonlinear scaling and validating the result against the field-count benchmarks for the x86_64-pc-windows-msvc target.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.