Skip to content

"serialize dep graph" with CARGO_INCREMENTAL=1 takes 26 minutes and 18 GB RSS #39208

Closed
@SimonSapin

Description

@SimonSapin

Building Servo with CARGO_INCREMENTAL=1, the script crate takes an unusually long time to build and uses a lot of RAM. Here is an extract of the output of -Z time-passes:

time: 0.224; rss: 122MB	parsing
[…]
time: 1.328; rss: 2689MB	MIR optimisations
  time: 0.296; rss: 2784MB	write metadata
  time: 2.442; rss: 2871MB	translation item collection
  time: 0.717; rss: 2897MB	codegen unit partitioning
  time: 0.608; rss: 10324MB	internalize symbols
time: 78.431; rss: 10325MB	translation
time: 0.000; rss: 10325MB	assert dep graph
time: 1603.681; rss: 10048MB	serialize dep graph
  time: 0.000; rss: 8851MB	llvm function passes [2]
  […]
  time: 12.903; rss: 9397MB	codegen passes [42]
time: 51.898; rss: 9394MB	LLVM passes
time: 0.000; rss: 9394MB	serialize work products
time: 9.727; rss: 1411MB	linking

Most of the time (over 26 minutes) is spent in "serialize dep graph". During that time, RSS memory usage slowly grows from ~10 GB to ~18 GB. It goes back down to ~10 GB before the end of this pass.

For comparison, this is the same crate without CARGO_INCREMENTAL=1 (but with -C codegen-units=4):

time: 0.204; rss: 118MB	parsing
[…]
time: 1.278; rss: 2093MB	MIR optimisations
  time: 0.279; rss: 2185MB	write metadata
  time: 2.365; rss: 2269MB	translation item collection
  time: 0.987; rss: 2295MB	codegen unit partitioning
  time: 0.582; rss: 4633MB	internalize symbols
time: 33.135; rss: 4633MB	translation
time: 0.000; rss: 4633MB	assert dep graph
time: 0.000; rss: 4633MB	serialize dep graph
  time: 0.904; rss: 3123MB	llvm function passes [3]
  […]
  time: 30.495; rss: 3369MB	codegen passes [0]
time: 34.953; rss: 3369MB	LLVM passes
time: 0.000; rss: 3369MB	serialize work products
time: 2.195; rss: 468MB	linking
    Finished dev [unoptimized + debuginfo] target(s) in 101.86 secs

CC @mw, @nikomatsakis @michaelwoerister

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationI-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions