Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Last active June 26, 2018 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikomatsakis/128d75107ce31370c6f76b9a5d41448c to your computer and use it in GitHub Desktop.
Save nikomatsakis/128d75107ce31370c6f76b9a5d41448c to your computer and use it in GitHub Desktop.

2018.06.28

HEAD: 9e67309451

Version Times Comment
Plain 3.66s
NLL 6.06s
Ratio 1.65 (NLL / plain)
% 0.39% (NLL - plain) / NLL
  • {do_mir_borrowck} is 37%
    • compute_regions is 17%
      • {type_check_internal} is 7%
      • {generate_constraints} is 3%
      • {liveness_of_locals} is 2%
      • {RegionInferenceContext::solve} is 2%
      • {RegionInferenceContext::new} is 1%
    • visit_statement_entry is 7%
    • do_dataflow is 5%
    • visit_terminator_entry is 2%

Looking at hotspots from the perf focus graph, I found some possible routes for further exploration:

  • Rewrite places_conflict to not use zipped iterators, or to use a custom iterator that walks back places lazilly
    • the perf annotate results seem to suggest that a lot of time is being spent in the iterator and smallvec machinery; rewriting may or may not help though
  • check for duplicate constraints (We are
  • liveness is non-trivial percentage (2%)
    • it is currently iterating over the whole graph every time
    • keep a "changed" list?
    • using datafrog would be better, but that might require more careful thought about how to integrate the results
    • still, perhaps worth pursuing
  • liveness simulate_block
    • allocates a temporary per basic block; it could be shared across all basic blocks
    • this func is 1% on the profile but it's basically all here
  • lazier causal tracking (rust-lang/rust#51710)
    • seems to account for most of generate_constraints
  • optimizing canonicalization (rust-lang/rust#48417)
    • 6% of total time
    • but 2% of MIR borrowck time
    • still, a clear win and one that will pay dividends over time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment