Stream: t-compiler

Topic: analyzing where the compiler spends its time


nikomatsakis (Nov 27 2018 at 16:01, on Zulip):

So one of the follow-up items from our last steering meeting was:

gather statistics about where we spend our time from perf and perhaps elsewhere

I was wondering whether @Wesley Wiser, @nnethercote, or anyone else might be interesting in taking a stab at this. I figured we'd start by selecting some benchmarks and designing a methodology.

Actually, maybe the approach we should do is to schedule a 1hr slot or so to work out the plan, and then open up some issues?

nikomatsakis (Nov 27 2018 at 16:01, on Zulip):

@mw do you still feel good about your "scenarios"

mw (Nov 27 2018 at 16:12, on Zulip):

The RLS case does not measure actual RLS performance very well.

Wesley Wiser (Nov 27 2018 at 16:12, on Zulip):

@nikomatsakis I'm interested and always happy to help out where I can.

mw (Nov 27 2018 at 16:12, on Zulip):

It should maybe be renamed to CHECK

nikomatsakis (Nov 27 2018 at 16:13, on Zulip):

maybe we could meet to dsicuss and plan out tomorrow, say around 10am boston time( same as compiler mtg)?

nikomatsakis (Nov 27 2018 at 16:13, on Zulip):

I'm not feeling well today and it's late for @mw

mw (Nov 27 2018 at 16:13, on Zulip):

I'm not so sure about the DIST scenario. It's important, but it's compile time might not be too important

nikomatsakis (Nov 27 2018 at 16:13, on Zulip):

not sure @Wesley Wiser what your constraints are tho

nikomatsakis (Nov 27 2018 at 16:14, on Zulip):

of course we could chat on zulip

Wesley Wiser (Nov 27 2018 at 16:14, on Zulip):

Zulip is always fine and I probably find time to schedule a 1hr meeting in

mw (Nov 27 2018 at 16:15, on Zulip):

tomorrow works for me

nikomatsakis (Nov 27 2018 at 16:21, on Zulip):

I will create a calendar invite

blitzerr (Nov 27 2018 at 17:02, on Zulip):

@nikomatsakis @Wesley Wiser @nnethercote and @mw I am interested in optimization problems but unfortunately don't know enough. If someone is willing to coach me, I would love to take a piece of the work.

nagisa (Nov 27 2018 at 17:23, on Zulip):

I want to get full tracing of queries and whatever else compiler does. I think it should be fairly easy to derive information about perf from that.

nikomatsakis (Nov 28 2018 at 15:16, on Zulip):

hey @mw @Wesley Wiser

nikomatsakis (Nov 28 2018 at 15:16, on Zulip):

so I just woke up from a nap :)

nikomatsakis (Nov 28 2018 at 15:17, on Zulip):

want to chat?

mw (Nov 28 2018 at 15:19, on Zulip):

:wave:

Wesley Wiser (Nov 28 2018 at 15:19, on Zulip):

:wave:

nikomatsakis (Nov 28 2018 at 15:19, on Zulip):

we could chat over video but maybe zulip will suffice?

mw (Nov 28 2018 at 15:20, on Zulip):

both is fine with me

Wesley Wiser (Nov 28 2018 at 15:20, on Zulip):

Whichever works for me

nikomatsakis (Nov 28 2018 at 15:20, on Zulip):

mainly I was hoping we could kind of draw up a "plan" regarding what to measure

nikomatsakis (Nov 28 2018 at 15:21, on Zulip):

I'm trying now to bring some of this back in cache a bit

mw (Nov 28 2018 at 15:21, on Zulip):

@Wesley Wiser and I chatted a bit about making -Zself-profile more detailed

mw (Nov 28 2018 at 15:21, on Zulip):

i.e. I gave him my wishlist :)

nikomatsakis (Nov 28 2018 at 15:23, on Zulip):

=)

nikomatsakis (Nov 28 2018 at 15:23, on Zulip):

@mw where was the list of issues you had for different scenarios?

mw (Nov 28 2018 at 15:24, on Zulip):

https://github.com/rust-lang/rust/issues/48750

nikomatsakis (Nov 28 2018 at 15:24, on Zulip):

also, maybe we can separate out future impovements to self-profile from things we can measure now?

nikomatsakis (Nov 28 2018 at 15:24, on Zulip):

(in other words, can we make measurements without those, or do we feel like we have to do self-profile improvements?)

mw (Nov 28 2018 at 15:24, on Zulip):

yes, let's start with defining a goal for the conversation

nikomatsakis (Nov 28 2018 at 15:24, on Zulip):

I guess we could use the perf measurements

nikomatsakis (Nov 28 2018 at 15:25, on Zulip):

my main goal is to help us drive our prioritization for upcoming year

mw (Nov 28 2018 at 15:25, on Zulip):

are we interested in defining a methodology for measuring compiler performance?

mw (Nov 28 2018 at 15:25, on Zulip):

because that would be a big topic

nikomatsakis (Nov 28 2018 at 15:26, on Zulip):

I'm not entirely sure what that means

nikomatsakis (Nov 28 2018 at 15:26, on Zulip):

I think I was imagining something less ambitious though

mw (Nov 28 2018 at 15:26, on Zulip):

yes, me too

nikomatsakis (Nov 28 2018 at 15:26, on Zulip):

more like identifying a set of specific test cases and specific things we can figure out from them

mw (Nov 28 2018 at 15:27, on Zulip):

(but https://github.com/rust-lang/rust/issues/48750 is more ambitious :) )

Wesley Wiser (Nov 28 2018 at 15:28, on Zulip):

I looked at the meeting notes and the discussion around profiling seemed to be in the context of determining how much time is spent prior to the start of the query system. The discussion seemed to mostly be about pushing more early stuff into queries https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/subject/steering.20meeting.202018-11-16/near/147824772

nikomatsakis (Nov 28 2018 at 15:28, on Zulip):

I think I would probably start with things like "major phases":

and perhaps "incremental overhead" (ratio of from-scratch builds) as well as "current incremental potential" (ratio of "no-change builds")?

nikomatsakis (Nov 28 2018 at 15:29, on Zulip):

I figure @mw that the best way to design a more complete system is to first do some specific things for specific tests

nikomatsakis (Nov 28 2018 at 15:29, on Zulip):

and then generalize

mw (Nov 28 2018 at 15:30, on Zulip):

do the -Zself-profile categories match with the list above?

nikomatsakis (Nov 28 2018 at 15:30, on Zulip):

I don't know :)

Wesley Wiser (Nov 28 2018 at 15:30, on Zulip):

We don't have as many categories

mw (Nov 28 2018 at 15:30, on Zulip):

roughly, but not entirely

nikomatsakis (Nov 28 2018 at 15:30, on Zulip):

I guess it would be possible to tweak them

nikomatsakis (Nov 28 2018 at 15:30, on Zulip):

I was looking at my diagram

Wesley Wiser (Nov 28 2018 at 15:31, on Zulip):

https://github.com/rust-lang/rust/blob/master/src/librustc/util/profiling.rs#L125

Wesley Wiser (Nov 28 2018 at 15:31, on Zulip):

We can certainly tweak them

nikomatsakis (Nov 28 2018 at 15:31, on Zulip):

it seems like we definitely want to get a handle on what parsing/name-resolution/macro-expansion costs, because that informs the "extend query system earlier" question

mw (Nov 28 2018 at 15:31, on Zulip):

yes

nikomatsakis (Nov 28 2018 at 15:32, on Zulip):

I imagine trying to get the costs of trait selection etc -- which is a cross-cutting thing, not easily handled by -Zself-profile, but relatively easily handled by perf-focus -- would be of interest too

nikomatsakis (Nov 28 2018 at 15:32, on Zulip):

I've measured it before but I'd like to update it, particularly in light of existing work on chalk

nikomatsakis (Nov 28 2018 at 15:32, on Zulip):

One thing I don't really know is how to estimate the impact of MIR optimizations

mw (Nov 28 2018 at 15:32, on Zulip):

only half of trait selection is a query, right?

nikomatsakis (Nov 28 2018 at 15:33, on Zulip):

some parts of trait selection are queries, yeah, but some parts aren't

nikomatsakis (Nov 28 2018 at 15:33, on Zulip):

(part of the chalk transition plan is to finish that conversion)

mw (Nov 28 2018 at 15:33, on Zulip):

what about "polymorphization"?

mw (Nov 28 2018 at 15:34, on Zulip):

that seems like something that we could get numbers on

mw (Nov 28 2018 at 15:34, on Zulip):

i.e. how much LLVM IR would we save by deduplication

nikomatsakis (Nov 28 2018 at 15:34, on Zulip):

right so we can get some rough bounds

nikomatsakis (Nov 28 2018 at 15:34, on Zulip):

it'd be nice to know:

nikomatsakis (Nov 28 2018 at 15:34, on Zulip):
nikomatsakis (Nov 28 2018 at 15:35, on Zulip):
mw (Nov 28 2018 at 15:36, on Zulip):

ok, so we have three specific questions so far:

mw (Nov 28 2018 at 15:36, on Zulip):
mw (Nov 28 2018 at 15:36, on Zulip):
mw (Nov 28 2018 at 15:37, on Zulip):
mw (Nov 28 2018 at 15:37, on Zulip):

I would add another one:

mw (Nov 28 2018 at 15:37, on Zulip):
nikomatsakis (Nov 28 2018 at 15:37, on Zulip):

I was wondering about that

nikomatsakis (Nov 28 2018 at 15:37, on Zulip):

how are you planning to estimate that?

mw (Nov 28 2018 at 15:37, on Zulip):

because that's something we can measure right now

nikomatsakis (Nov 28 2018 at 15:38, on Zulip):

I'd also like to capture the "where in general do we spend our time" -- e.g. I have some "rule of thumb" numbers of like "50% type check, 50% trans/LLVM" that I think are pretty dated, and I would like to update

nikomatsakis (Nov 28 2018 at 15:38, on Zulip):

because that's something we can measure right now

using the existing support?

mw (Nov 28 2018 at 15:38, on Zulip):

well, we can get an upper bound by finding out how much time we spend in queries to begin with

mw (Nov 28 2018 at 15:38, on Zulip):

yes

mw (Nov 28 2018 at 15:39, on Zulip):

this ties back into -Zself-profile

mw (Nov 28 2018 at 15:39, on Zulip):

I think

nikomatsakis (Nov 28 2018 at 15:39, on Zulip):

so if we can answer those bullets you raised plus maybe a fifth of

that'd be amazing

mw (Nov 28 2018 at 15:39, on Zulip):

we would need to split LLVM and "codegen" though

nikomatsakis (Nov 28 2018 at 15:39, on Zulip):

now the question is -- for which crates to measure :)

Wesley Wiser (Nov 28 2018 at 15:39, on Zulip):

Yeah, we'd need to make -Zself-profile work with parallel queries

nikomatsakis (Nov 28 2018 at 15:39, on Zulip):

we would need to split LLVM and "codegen" though

yes, I'd like to see those separated

Wesley Wiser (Nov 28 2018 at 15:39, on Zulip):

(It doesn't currently)

mw (Nov 28 2018 at 15:40, on Zulip):

we can start without integrating self-profile and parallel queries, I think

mw (Nov 28 2018 at 15:40, on Zulip):

i.e. finding out how much time we spend in queries to begin with

mw (Nov 28 2018 at 15:41, on Zulip):

regarding which crates to measure:

mw (Nov 28 2018 at 15:41, on Zulip):
mw (Nov 28 2018 at 15:41, on Zulip):
nikomatsakis (Nov 28 2018 at 15:42, on Zulip):

hmm

nikomatsakis (Nov 28 2018 at 15:42, on Zulip):

this is a typical challenge

mw (Nov 28 2018 at 15:42, on Zulip):

but we can try to pick a good "middleground" crate

mw (Nov 28 2018 at 15:43, on Zulip):

i.e. something that has a bit of everything?

mw (Nov 28 2018 at 15:43, on Zulip):

or maybe the larger the project, the better?

nikomatsakis (Nov 28 2018 at 15:43, on Zulip):

to the extent that we're going to have to do manual profiling

nikomatsakis (Nov 28 2018 at 15:43, on Zulip):

I'd like to avoid measuring a ton of crates

mw (Nov 28 2018 at 15:43, on Zulip):

yeah

nikomatsakis (Nov 28 2018 at 15:43, on Zulip):

but maybe that's arguing for us setting up more automated variants ;)

nikomatsakis (Nov 28 2018 at 15:44, on Zulip):

I feel like I'd like to measure the stylo/script crates

nikomatsakis (Nov 28 2018 at 15:44, on Zulip):

since they are "in production" and known pain points

mw (Nov 28 2018 at 15:44, on Zulip):

yeah

nikomatsakis (Nov 28 2018 at 15:44, on Zulip):

I wonder if it would make sense to measure librustc

nikomatsakis (Nov 28 2018 at 15:44, on Zulip):

it seems pretty dang slow to me

nikomatsakis (Nov 28 2018 at 15:44, on Zulip):

and/or libstd

nikomatsakis (Nov 28 2018 at 15:44, on Zulip):

not sure if they are "representative" but they are near and dear to our hearts :)

mw (Nov 28 2018 at 15:45, on Zulip):

yeah

nikomatsakis (Nov 28 2018 at 15:45, on Zulip):

I wonder if we could do a sort of "breadth-first search" approach -- basically, try to measure a few crates and see how much they diverge (probably we should aim for things likely to diverge)

nikomatsakis (Nov 28 2018 at 15:45, on Zulip):

if they are all showing similar results, we can stop

nikomatsakis (Nov 28 2018 at 15:45, on Zulip):

if we are seeing a lot of variation, we can draw some more samples

nikomatsakis (Nov 28 2018 at 15:45, on Zulip):

I am imagining trying to pick from the various categories you drew up

mw (Nov 28 2018 at 15:45, on Zulip):

I mean, when I think of perf.rlo results in general: most optimization benefit all crates

mw (Nov 28 2018 at 15:45, on Zulip):

unless they are edge cases

nikomatsakis (Nov 28 2018 at 15:46, on Zulip):

yes

nikomatsakis (Nov 28 2018 at 15:46, on Zulip):

it would be helpful at some point to go over perf and try to categorize

nikomatsakis (Nov 28 2018 at 15:46, on Zulip):

I have some feeling for this from NLL

nikomatsakis (Nov 28 2018 at 15:46, on Zulip):

though my memory is fading :)

nikomatsakis (Nov 28 2018 at 15:46, on Zulip):

but e.g. keccak is an edge case, very very large CFG, otherwise very simple

Wesley Wiser (Nov 28 2018 at 15:47, on Zulip):

Targeting "general" crates makes sense to me. It seems like people complain about compiler perf for most crates not just the edge-case ones.

mw (Nov 28 2018 at 15:47, on Zulip):

yeah, the various *-stress crates too

mw (Nov 28 2018 at 15:47, on Zulip):

I agree

nikomatsakis (Nov 28 2018 at 15:47, on Zulip):

I think we should measure

nikomatsakis (Nov 28 2018 at 15:47, on Zulip):

well let's try to look at the categories I guess

nikomatsakis (Nov 28 2018 at 15:48, on Zulip):

well I guess this is distinct from the scenarios in https://github.com/rust-lang/rust/issues/48750

mw (Nov 28 2018 at 15:49, on Zulip):

yes

nikomatsakis (Nov 28 2018 at 15:49, on Zulip):

I am imagining sort of :

nikomatsakis (Nov 28 2018 at 15:49, on Zulip):

serde is interesting because maybe some costs from using it are deferred until the code is instantiated

Wesley Wiser (Nov 28 2018 at 15:49, on Zulip):

Is winapi still super slow?

nikomatsakis (Nov 28 2018 at 15:49, on Zulip):

since I imagine it's tons of generics

nikomatsakis (Nov 28 2018 at 15:49, on Zulip):

mm good call

Wesley Wiser (Nov 28 2018 at 15:49, on Zulip):

I guess that's hard to measure since you have to build on Windows

nikomatsakis (Nov 28 2018 at 15:50, on Zulip):

measuring on windows is hard of course

nikomatsakis (Nov 28 2018 at 15:50, on Zulip):

:(

nikomatsakis (Nov 28 2018 at 15:50, on Zulip):

maybe I can justify buying that Surface Pro after all ;)

mw (Nov 28 2018 at 15:50, on Zulip):

it also depends on the version, I think

mw (Nov 28 2018 at 15:50, on Zulip):

newer versions are faster to compile

Wesley Wiser (Nov 28 2018 at 15:50, on Zulip):

Yeah, I seem to recall they restructured the crate to make it faster

mw (Nov 28 2018 at 15:50, on Zulip):

but I think there are some open issues on GH about winapi being slow

nikomatsakis (Nov 28 2018 at 15:51, on Zulip):

I sort of recall @mw that we tried to do a categorization of this kind at some point

mw (Nov 28 2018 at 15:51, on Zulip):

yeah, probably as part of setting up perf.rlo

mw (Nov 28 2018 at 15:51, on Zulip):

and/or the scenarios

mw (Nov 28 2018 at 15:52, on Zulip):

ok, so...

nikomatsakis (Nov 28 2018 at 15:52, on Zulip):

ps only mildly related but I missed this insightful comment from @nnethercote somehow.

nikomatsakis (Nov 28 2018 at 15:52, on Zulip):

(about how to weight multiple runs)

mw (Nov 28 2018 at 15:52, on Zulip):

so far we've only talked about "raw" compilation performance

mw (Nov 28 2018 at 15:52, on Zulip):

do we care about RLS?

nikomatsakis (Nov 28 2018 at 15:52, on Zulip):

well

mw (Nov 28 2018 at 15:53, on Zulip):

I mean, of course, we care :)

nikomatsakis (Nov 28 2018 at 15:53, on Zulip):

what do you mean by RLS, to start :)

mw (Nov 28 2018 at 15:53, on Zulip):

the actual RLS

nikomatsakis (Nov 28 2018 at 15:53, on Zulip):

so

nikomatsakis (Nov 28 2018 at 15:53, on Zulip):

what I mean is

nikomatsakis (Nov 28 2018 at 15:53, on Zulip):

I guess it'd be useful just to measure save-analysis

nikomatsakis (Nov 28 2018 at 15:54, on Zulip):

and whatever else the RLS does literally right now

nikomatsakis (Nov 28 2018 at 15:54, on Zulip):

it's also interesting to try and estimate what are the biggest obstacles to the RLS being able to interactively invoke the compiler, but I think that some of our measurements (e.g., looking at parse time etc) are relevant to that

mw (Nov 28 2018 at 15:54, on Zulip):

yes, we don't have any numbers on that at all, I think

nikomatsakis (Nov 28 2018 at 15:55, on Zulip):

I'm sort of inclined to measure the things we listed and then "reconvene"

mw (Nov 28 2018 at 15:55, on Zulip):

since our time is almost up, can we try to distill some concrete action items?

nikomatsakis (Nov 28 2018 at 15:55, on Zulip):

though maybe it'd be good to at least figure out how to measure RLS save analysis

mw (Nov 28 2018 at 15:56, on Zulip):

an easy one would be separating codegen and LLVM in self-profile

mw (Nov 28 2018 at 15:56, on Zulip):

that would also be useful, I think

Wesley Wiser (Nov 28 2018 at 15:57, on Zulip):

Is "codegen" the time spent emitting LLVM BC but not time running LLVM passes + linking?

mw (Nov 28 2018 at 15:58, on Zulip):

yes

mw (Nov 28 2018 at 15:59, on Zulip):

do we want to create a "benchmark" repository ?

nikomatsakis (Nov 28 2018 at 15:59, on Zulip):

let's review. We identified a few "raw perf" measurements that'd be useful:

We mentioned the idea of measuring on a few crates like:

and see where that goes

nikomatsakis (Nov 28 2018 at 15:59, on Zulip):

do we want to create a "benchmark" repository ?

well, we have the existing one, right?

nikomatsakis (Nov 28 2018 at 15:59, on Zulip):

one action item would be:

nikomatsakis (Nov 28 2018 at 15:59, on Zulip):

I can take that one on

nikomatsakis (Nov 28 2018 at 16:00, on Zulip):

(I guess we have to settle on a specific rustc)

Wesley Wiser (Nov 28 2018 at 16:00, on Zulip):

2018 beta compiler?

mw (Nov 28 2018 at 16:00, on Zulip):

why not :)

mw (Nov 28 2018 at 16:01, on Zulip):

I'll look into parallel query performance

nikomatsakis (Nov 28 2018 at 16:01, on Zulip):

an easy one would be separating codegen and LLVM in self-profile

@Wesley Wiser do you want to try adjusting self-profile then?

Wesley Wiser (Nov 28 2018 at 16:02, on Zulip):

Sure!

mw (Nov 28 2018 at 16:02, on Zulip):

can you add the percentage column too?

nikomatsakis (Nov 28 2018 at 16:02, on Zulip):

how does it presently handle "pre-query" time?

Wesley Wiser (Nov 28 2018 at 16:02, on Zulip):

@mw I'll look in to that too

nikomatsakis (Nov 28 2018 at 16:03, on Zulip):

the big question mark then is "polymorphization"— I'd like to check-in a bit with @Alex Crichton here, as I recall them doing some measurements that seem relevant

Wesley Wiser (Nov 28 2018 at 16:03, on Zulip):

I'd have to check. We have some ad-hoc timers for certain things.

Wesley Wiser (Nov 28 2018 at 16:03, on Zulip):

Parsing is one of those I think

nikomatsakis (Nov 28 2018 at 16:03, on Zulip):

I think the other bullet points are sort of "covered", or at least would be if we tweak self-profile and then run it :)

mw (Nov 28 2018 at 16:03, on Zulip):

This seems like a good references for self-profile categories

nikomatsakis (Nov 28 2018 at 16:04, on Zulip):

(I'm not sure if that breakdown is good btw it was just kind of ad-hoc)

nikomatsakis (Nov 28 2018 at 16:04, on Zulip):

but I think it sounds "roughly right", maybe a few missing things

nikomatsakis (Nov 28 2018 at 16:04, on Zulip):

it'd be interesting to know if there are significant time sinks not on that list

mw (Nov 28 2018 at 16:05, on Zulip):

I'll take a look later and report back if I find anything

Jake Goulding (Nov 28 2018 at 16:05, on Zulip):

From a self-interest POV, I have a crate that takes ~3s (20s in release) to compile (just doing a touch src/lib.rs). It's not a popular crate, but I think it'd be great if there's enough automated mechanism for people to participate in this by providing info somehow.

nikomatsakis (Nov 28 2018 at 16:06, on Zulip):

interesting

nikomatsakis (Nov 28 2018 at 16:07, on Zulip):

when we do ad-hoc measurements, as I think @mw and I sort of plan to do,

nikomatsakis (Nov 28 2018 at 16:07, on Zulip):

we should definitely document what we are doing and how

nikomatsakis (Nov 28 2018 at 16:07, on Zulip):

that would permit us to "crowd-source" a bit

mw (Nov 28 2018 at 16:07, on Zulip):

yeah

nikomatsakis (Nov 28 2018 at 16:07, on Zulip):

to start @Jake Goulding you might run with -Zself-profile =)

mw (Nov 28 2018 at 16:09, on Zulip):

though I think we should use perf.rlo as much as we can

nikomatsakis (Nov 28 2018 at 16:09, on Zulip):

ok do we feel like we have concrete action items? I have down:

nikomatsakis (Nov 28 2018 at 16:09, on Zulip):

though I think we should use perf.rlo as much as we can

yes definitely

nikomatsakis (Nov 28 2018 at 16:10, on Zulip):

I would like to see self-profile available for perf.rlo, in particular

nikomatsakis (Nov 28 2018 at 16:10, on Zulip):

I had talked to @simulacrum about that, it didn't seem too hard as I recall

Wesley Wiser (Nov 28 2018 at 16:10, on Zulip):

They're working on it, I believe

mw (Nov 28 2018 at 16:10, on Zulip):

https://github.com/rust-lang-nursery/rustc-perf/issues/299

nikomatsakis (Nov 28 2018 at 16:10, on Zulip):

it'd be great if we could easily get the data for any given test and/or aggregated over sets of tests...

nikomatsakis (Nov 28 2018 at 16:10, on Zulip):

ah, nice

Wesley Wiser (Nov 28 2018 at 16:13, on Zulip):

I need to run soon. Is there anything else we should talk about?

mw (Nov 28 2018 at 16:14, on Zulip):

I'll post thoughts about the list of categories within the next hour

mw (Nov 28 2018 at 16:16, on Zulip):

other than that, I think we all have something to do for now, right?

Jake Goulding (Nov 28 2018 at 16:36, on Zulip):

My secret ambition is that y'all teach the compiler to teach me (and other users) how to "make go fast"

mw (Nov 28 2018 at 16:37, on Zulip):

Additional categories might be
- constant evaluation
- type collection (i.e. lowering from HIR to Ty)

mw (Nov 28 2018 at 16:39, on Zulip):

"type collection" (which could use a better name) would include the following:
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
[] fn generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics,
[] fn predicates_of: PredicatesOfItem(DefId) -> Lrc<ty::GenericPredicates<'tcx>>,
[] fn predicates_defined_on: PredicatesDefinedOnItem(DefId)
[] fn explicit_predicates_of: ExplicitPredicatesOfItem(DefId)
[] fn inferred_outlives_of: InferredOutlivesOf(DefId) -> Lrc<Vec<ty::Predicate<'tcx>>>,
[] fn super_predicates_of: SuperPredicatesOfItem(DefId) -> Lrc<ty::GenericPredicates<'tcx>>,
[] fn type_param_predicates: type_param_predicates((DefId, DefId))
[] fn trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
[] fn adt_def: Adt
[] fn variances_of: ItemVariances(DefId) -> Lrc<Vec<ty::Variance>>,

simulacrum (Nov 28 2018 at 21:27, on Zulip):

Yes, I'm working on the self profile feature -- I ran into a few blocks due to rustc not producing appropriate output (invalid JSON) but I believe they've all been fixed, but I ran out of time last week to work on it because of that

nikomatsakis (Nov 30 2018 at 18:54, on Zulip):

@simulacrum question — for the serde-* stuff on prof, do we have any scenario that tests "code using serde"?

simulacrum (Nov 30 2018 at 18:55, on Zulip):

I think cargo does, for example

nikomatsakis (Nov 30 2018 at 19:00, on Zulip):

ok but not one named "serde" :)

nikomatsakis (Nov 30 2018 at 19:00, on Zulip):

(and not a "canonical" one)

simulacrum (Nov 30 2018 at 19:02, on Zulip):

@nikomatsakis Is that what you were referring to?

simulacrum (Nov 30 2018 at 19:02, on Zulip):

Oh, you mean other proc macros?

simulacrum (Nov 30 2018 at 19:02, on Zulip):

Maybe the servo crates? They have proc macros of their own

simulacrum (Nov 30 2018 at 19:02, on Zulip):

crates.io uses diesel, I believe

simulacrum (Nov 30 2018 at 19:02, on Zulip):

then.. no, I don't think so

simulacrum (Nov 30 2018 at 19:03, on Zulip):

uh Zulip is displaying my messages way out of order -- I think my wifi is being quite flaky right now -- but I would say that servo is the most non-canonical example of proc macro use, but it's also a lot so isn't the best example

simulacrum (Nov 30 2018 at 19:04, on Zulip):

I'd be happy to add another benchmark if you'd like

nikomatsakis (Nov 30 2018 at 19:10, on Zulip):

ok not sure 100% what I want tbh :)

nikomatsakis (Nov 30 2018 at 19:11, on Zulip):

apparently I can't build the script crate without having installed X11

nikomatsakis (Nov 30 2018 at 19:11, on Zulip):

which.. I guess I can do :P

nikomatsakis (Nov 30 2018 at 19:23, on Zulip):

so far, I've found trait solving seems to occupy relatively little (0-5%) of the time in the crates I've looked at (serde, style)

nikomatsakis (Nov 30 2018 at 19:23, on Zulip):

it's lower than I expected, really

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

@simulacrum if I'm running locally ...

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

hmm

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

I geuss there are tools to "run the harness"

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

I should really use those instead of doing everything manually :)

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

sorry, that wasn't a question

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

perhaps an actual question is:

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

I can use perf record on the harness itsel

nikomatsakis (Nov 30 2018 at 19:37, on Zulip):

it'll have some noise, but I guess the vast majority of time is running rustc so it's not that interesting

nikomatsakis (Nov 30 2018 at 19:38, on Zulip):

is there some way though to introduce a per-test-scenario use of perf?

nikomatsakis (Nov 30 2018 at 19:38, on Zulip):

(not on the server, just locally)

lqd (Nov 30 2018 at 19:40, on Zulip):

you mean profiling using rustc-perf ? like this ?

nikomatsakis (Nov 30 2018 at 19:42, on Zulip):

lol um yes

nikomatsakis (Nov 30 2018 at 19:42, on Zulip):

I sort of remember those docs now

nikomatsakis (Nov 30 2018 at 19:42, on Zulip):

anyway right now I'm just trying to get that stuff to build

nikomatsakis (Nov 30 2018 at 19:42, on Zulip):

I recently reinstalled my OS and don't have a lot of base packages it seems

nikomatsakis (Nov 30 2018 at 19:42, on Zulip):

e.g., openssl-dev...

nikomatsakis (Nov 30 2018 at 19:51, on Zulip):

right now I just get

error: failed to run custom build command for `openssl v0.9.24`
process didn't exit successfully: `/home/nmatsakis/versioned/rustc-perf/target/release/build/openssl-7743ee6a3ccb90da/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/nmatsakis/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...

but I think I have everything installed I'm supposed to have :/

QuietMisdreavus (Nov 30 2018 at 19:53, on Zulip):

@nikomatsakis out of curiosity, what does openssl version say?

QuietMisdreavus (Nov 30 2018 at 19:54, on Zulip):

openssl 0.9.24 is an old release of the crate, and i don't think it supports the latest openssl

QuietMisdreavus (Nov 30 2018 at 19:54, on Zulip):

(i've had problems with it when arch moved from openssl 1.0 to 1.1)

lqd (Nov 30 2018 at 19:56, on Zulip):

yeah looks like openssl 1.0.1+ requires rust-openssl 0.10

nikomatsakis (Nov 30 2018 at 20:00, on Zulip):

ah

nikomatsakis (Nov 30 2018 at 20:00, on Zulip):

@QuietMisdreavus I get

OpenSSL 1.1.1 FIPS  11 Sep 2018
nikomatsakis (Nov 30 2018 at 20:00, on Zulip):

I wonder where that dependency comes from

nikomatsakis (Nov 30 2018 at 20:00, on Zulip):

(I filed https://github.com/sfackler/rust-openssl/issues/1024, as an aside)

lqd (Nov 30 2018 at 20:01, on Zulip):

https://github.com/sfackler/rust-openssl/issues/987#issuecomment-419246104

QuietMisdreavus (Nov 30 2018 at 20:01, on Zulip):

yup, too new, i bet

nikomatsakis (Nov 30 2018 at 20:02, on Zulip):

grr

nikomatsakis (Nov 30 2018 at 20:03, on Zulip):

there's about a bajillion things that depend on openssl 0.9

nikomatsakis (Nov 30 2018 at 20:04, on Zulip):

according to cargo tree anyway :)

nikomatsakis (Nov 30 2018 at 20:06, on Zulip):

maybe there's a way to install an older version of openssl...

nikomatsakis (Nov 30 2018 at 20:56, on Zulip):

gah. I can't get this to build at all

nikomatsakis (Nov 30 2018 at 20:56, on Zulip):

/me throws up hands in frustration

nagisa (Dec 01 2018 at 14:34, on Zulip):

I’ve noticed that compiler always gets into some stage that is not parallelized at all multiple times within a compilation

nagisa (Dec 01 2018 at 14:35, on Zulip):

that is, it stays at 100% CPU for a while, then jumps to somewhere near 1600, then back to 100, then to 1600 while it is codegenning and finally falls of once there are not enough codegen units to saturate the cores

nagisa (Dec 01 2018 at 14:36, on Zulip):

we might win something if we made those sequential parts more parallel :slight_smile:

nagisa (Dec 01 2018 at 14:37, on Zulip):

which reminds me, this -Zself-profile output (since it does not yet output a full trace) lacks distinction between user time and cpu time, there might be some value in making that distinction and displaying it somehow.

Zoxc (Dec 01 2018 at 14:52, on Zulip):

I've found that around 80 codegen units is ideal, with parallel queries =P

Zoxc (Dec 01 2018 at 14:57, on Zulip):

Can we get a beta build with parallel queries enabled? So I can build rustc using it

simulacrum (Dec 01 2018 at 15:00, on Zulip):

@Zoxc You can always build it yourself and specify it in rustc= in config.toml

simulacrum (Dec 01 2018 at 15:01, on Zulip):

I don't think it'll be easy to get a proper beta build though (since queries are probably not stable enough for wide distribution)

Zoxc (Dec 01 2018 at 15:17, on Zulip):

@simulacrum Well I want something prebuild so I could use it just by ./x.py -p check or something like that. Doesn't have to be something proper

simulacrum (Dec 01 2018 at 15:18, on Zulip):

I don't think we publish artifacts right now -- you could possibly put up a PR that enables it by default, run bors try, and use those artifacts...

simulacrum (Dec 01 2018 at 15:18, on Zulip):

(that PR could target beta to have the beta compiler)

nikomatsakis (Dec 04 2018 at 12:23, on Zulip):

ps @simulacrum seems like I can build rustc-perf now, thanks!

nikomatsakis (Dec 04 2018 at 12:23, on Zulip):

I'm sure you pinged me on discord, I've got a lot of pending pings there, harder to keep up with those

nikomatsakis (Dec 06 2018 at 14:09, on Zulip):

ok so @mw, @Wesley Wiser

I managed to gather some usable perf stats from all the benchmarks now. I've created a google spreadsheet mapping out how much time each of the tests spends in trait analysis + type-checking (note that these are two distinct sheets, and that these times are overlapping).

nikomatsakis (Dec 06 2018 at 14:09, on Zulip):

I can also do other slices as we like

nikomatsakis (Dec 06 2018 at 14:09, on Zulip):

this is from a run using the beta compiler :)

simulacrum (Dec 06 2018 at 14:29, on Zulip):

@nikomatsakis Is that spreadsheet perhaps very selectively shared? I at least can't access it :)

Wesley Wiser (Dec 06 2018 at 14:47, on Zulip):

@nikomatsakis I also cannot access it :)

nikomatsakis (Dec 06 2018 at 14:59, on Zulip):

oops

nikomatsakis (Dec 06 2018 at 15:00, on Zulip):

updated link

nikomatsakis (Dec 06 2018 at 15:00, on Zulip):

@Wesley Wiser, @simulacrum :point_up:

nikomatsakis (Dec 06 2018 at 15:00, on Zulip):

I'm not 100% confident in those numbers, maybe 90-95% :P

nikomatsakis (Dec 06 2018 at 15:00, on Zulip):

I'm debating about how to slice them better

nikomatsakis (Dec 06 2018 at 15:00, on Zulip):

e.g. I'd like to see them grouped by stuff "all check things"

nikomatsakis (Dec 06 2018 at 15:01, on Zulip):

I guess I can do this in google docs if I learn how

nikomatsakis (Dec 06 2018 at 15:01, on Zulip):

or I could edit my script :)

nikomatsakis (Dec 06 2018 at 15:01, on Zulip):

I'm not 100% confident in those numbers, maybe 90-95% :P

in particular, when I inspect the stack traces I get from perf script -i, they look... correct-ish, but sometimes smaller than I expect

nikomatsakis (Dec 06 2018 at 15:02, on Zulip):

note also that to gather those numbers, I had to disable frame-pointer optimization

nikomatsakis (Dec 06 2018 at 15:40, on Zulip):

so I was looking back at this list from before:

need to find good things to search for on the stack to identify each of those categories...

Last update: Nov 16 2019 at 01:35UTC