3

Github Stream the dep-graph to a file instead of storing it in-memory. by cjgill...

 3 years ago
source link: https://github.com/rust-lang/rust/pull/82780
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

cjgillot commented on Mar 4

edited

This is a reimplementation of #60035.

Instead of storing the dep-graph in-memory, the nodes are encoded as they come
into the a temporary file as they come. At the end of a successful the compilation,
this file is renamed to be the persistent dep-graph, to be decoded during the next
compilation session.

This two-files scheme avoids overwriting the dep-graph on unsuccessful or crashing compilations.

The structure of the file is modified to be the sequence of (DepNode, Fingerprint, EdgesVec).
The deserialization is responsible for going to the more compressed representation.
The node_count and edge_count are stored in the last 16 bytes of the file,
in order to accurately reserve capacity for the vectors.

At the end of the compilation, the encoder is flushed and dropped.
The graph is not usable after this point: any creation of a node will ICE.

I had to retrofit the debugging options, which is not really pretty.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK