Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upParameterData: avoid parameter attributes calc where possible #6348
Conversation
This comment has been minimized.
This comment has been minimized.
|
Ah, CI doesn't seem to run on a draft PR. |
auduchinok
marked this pull request as ready for review
Mar 20, 2019
auduchinok
closed this
Mar 20, 2019
auduchinok
reopened this
Mar 20, 2019
This comment has been minimized.
This comment has been minimized.
|
@auduchinok what figures around memory traffic are you seeing and under what scenario? Is there a before/after you could share? |
This comment has been minimized.
This comment has been minimized.
|
@cartermp I measured type checking after editing a rather big file in ReSharper.FSharp solution some time ago and remember seeing this method to be responsible for about half of allocations in reading custom attributes during that type check. I've opened the PR to have CI run the tests and for getting some feedback but wanted it to be a draft at first. |
auduchinok
force-pushed the
auduchinok:argName
branch
from
fbd1e88
to
12359b9
Mar 20, 2019
This comment has been minimized.
This comment has been minimized.
|
This looks great, the code is much nicer like this in any case |
KevinRansom
added
the
Ready
label
Apr 15, 2019
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Just to say we've long had problems with GetCustomAttrs as a cause of either
This has applied particularly in some cases where there are zillions of attributes on the target types/methods. The number of attributes in .NET metadata has also been steadily growing over time. The right solution is likely to be either
At a quick glance of the code I'm not sure of the effect on this PR - I think it might be making things worse in this regard, as property implementations like this will repeatedly compute the attribute where before it would have been computed once - I suspect each of these boolean flag computations should be cached into the ParamAttributes object? |
This comment has been minimized.
This comment has been minimized.
|
Thanks @dsyme that's good to know. I think we'll need to test this more thoroughly and look for |
This comment has been minimized.
This comment has been minimized.
|
I'm going to work on a benchmark dotnet test for type checking this week. Once that is in place, we can test this PR to see the results. |
This comment has been minimized.
This comment has been minimized.
TBH nothing beats the scenario-based testing like @cartermp has been doing, where we profile using the IDE tools. Many of the false assumptions in the compiler came from over-testing on compilation scenarios (where long-running memory is not considered expensive, since the process is not long-running), so we originally cached like crazy. IDE scenarios exercise the code very differently with different budgets So I don't really know what a benchmark would be that corresponds to IDE usage. Capturing a trace of calls into FCS might indicate what it would look like. |
This comment has been minimized.
This comment has been minimized.
No doubt we should absolutely test the scenarios by profiling like what @cartermp is doing. I just want to have a benchmark test where I can see allocation results and timing quickly in this case; I have had success with this before. It doesn't give insight into the long running memory problem, which is where memory dumps can help. I hope that makes sense. |
This comment has been minimized.
This comment has been minimized.
Benchmarks totally make sense. @vasily-kirichenko took a crack at something like this, it might make sense to revive (or replace) that, see |
KevinRansom
removed
the
Ready
label
Apr 16, 2019
This comment has been minimized.
This comment has been minimized.
|
Conflicts need attention, and I guess we'll wait to see the impact with additional testing. |


auduchinok commentedMar 20, 2019
•
edited
I've seen
GetParamDatasrepeatedly doing calculations and most of the results weren't used and thrown away. It was also generating noticeable memory traffic during type check (details in comments below).This PR makes it avoid these calculations where possible.