-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use a pooled StringBuilder in Dependency.GetID #3129
Conversation
Certainly. Add a package reference to Microsoft.CodeAnalysis.PooledObjects. |
You might also want to add a workaround for NuGet/Home#4856 to the project that will reference the source package: <ItemGroup>
<Compile Update="@(Compile)">
<Link Condition="'%(NuGetPackageId)' != ''">%(NuGetPackageId)\%(Link)</Link>
</Compile>
</ItemGroup> |
@tmat is it only on myget? |
Yes. |
Updated to use Microsoft.CodeAnalysis.PooledObjects |
@@ -20,6 +20,7 @@ | |||
|
|||
<PackageReference Include="NuGet.SolutionRestoreManager.Interop" Version="$(NuGetSolutionRestoreManagerInteropVersion)" /> | |||
<PackageReference Include="NuGet.VisualStudio" Version="$(NuGetVisualStudioVersion)" /> | |||
<PackageReference Include="Microsoft.CodeAnalysis.PooledObjects" Version="$(MicrosoftCodeAnalysisPooledObjectsVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tmat does this get pulled into the vsix automatically via repotoolset?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a source package - the sources are included into the project. No new binary dependencies are added.
build/Versions.props
Outdated
@@ -67,6 +67,7 @@ | |||
<!-- Roslyn --> | |||
<MicrosoftVisualStudioLanguageServicesVersion>2.6.0-beta1-62113-02</MicrosoftVisualStudioLanguageServicesVersion> | |||
<MicrosoftVisualStudioIntegrationTestUtilitiesVersion>2.6.0-beta1-62113-02</MicrosoftVisualStudioIntegrationTestUtilitiesVersion> | |||
<MicrosoftCodeAnalysisPooledObjectsVersion>2.6.0-beta1-62113-02</MicrosoftCodeAnalysisPooledObjectsVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use a newer version? This version does not have source link support, which might result in build failures.
2.7.0-beta3-62506-01 should be good (even newer ones require some toolset update that's not ready yet).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a new RepoToolset built in a moment that supports the latest compiler source packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was just trying to match the version of the rest of the Roslyn packages, but I can update this one with a comment about why it is different. So I should pick the latest 2.7 package, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated, but I'm seeing a new error on my work machine that I wasn't seeing at home:
ProjectSystem\VS\Tree\Dependencies\Snapshot\Dependency.cs(337,23): error CS0122: 'PooledStringBuilder' is inaccessible due to its protection level [C:\Code\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\mvsokklc.tmp_proj]
Looks like the xaml tmp_proj isn't getting the files added to it. Any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd. Not sure how much the XAML project differs from regular project. My guess would be that nuget can't determine what language it is from the extension and thus doesn't know what language to pick from the source package content types. Perhaps forcing <Language>C#</Language>
in Directory.Build.props file next to the project might work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing and re-opening to get CI to run. |
FYI, i just ran a small experiment https://gist.github.com/abpiskunov/ba0900a9b38eba27c33e26b6d48d6b85 and string.Join clearly wins vs StringBuilder for small number of strings.... |
Actually never mind, i did not do restart on stopwatch :( and had intervals instead of separate time chunks. StringBuilder is still better than Join, though they are close in case of small sets of strings. |
Bumping to a top level comment. I can't build this because I get:
Note the |
Also @nguerrera and also @onovotny, since I heard Sdk.Extras might have had to deal with this. |
@Pilchie This may help. There's a workaround in there: |
41e54db
to
2b73f3b
Compare
Okay, pushed a couple more commits. Please take another look. |
build/Versions.props
Outdated
@@ -70,6 +70,9 @@ | |||
<RoslynIntegrationVsixVersion>2.6.0.6211302</RoslynIntegrationVsixVersion> | |||
<MicrosoftNetRoslynDiagnosticsVersion>2.6.0-beta1-62322-01</MicrosoftNetRoslynDiagnosticsVersion> | |||
|
|||
<!-- From roslyn, but source package, so okay for version to mismatch the above --> | |||
<MicrosoftCodeAnalysisPooledObjectsVersion> 2.7.0-beta3-62511-04</MicrosoftCodeAnalysisPooledObjectsVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: 2 blank spaces here in value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Actually a TAB!!!
break; | ||
} | ||
|
||
return builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This return seems wrong. It unconditionally returns from function the first time a value in trimChars
is not the end of the build.r
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, those are the semantics of TrimEnd - remove characters from the end of the string that are one of trimChars
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider "hello".TrimEnd("zo")
. That produces "hell"
. Your change though will produce "hello"
because you unconditionally return after z
doesn't match o
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Thanks, I thought I had that, but clearly not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an explicit check for a match.
2b73f3b
to
d70ecd7
Compare
Traces showed this taking upward of 1% of allocations of opening a solution. Fixes dotnet#2918.
d70ecd7
to
59961f4
Compare
And fixed my broken rebase :( |
Or, that being the |
@Pilchie that error is on the WPF temp project file and you're setting the VB language version in a section for VB only. Guessing it's that issue. |
"that issue" is usually that the project doesn't know what language it is, but in this case, it knew to apply the VB setting, so instead it sounds like it's failing to apply the toolset compiler. Any idea how to workaround? In the meantime, I think I just won't specify langver for VB. |
Now I seem to be getting a compiler crash in C# :(
|
Re compiler versions used: As for the compiler crash ... looking into the log now: https://ci.dot.net/job/dotnet_project-system/job/dev15.6.x/job/windows_debug_prtest/12/artifact/artifacts/debug/log/ ... |
I see no obvious issue :( |
We appear to set Maybe worth updating? |
@Pilchie Definitely. I'd just remove it so that it defaults to the one defined in RepoToolset. |
No joy:
|
94e4ec1
to
4666ca2
Compare
SGTM |
Traces showed this taking upward of 1% of allocations of opening a solution.
Fixes #2918.
What does the customer do to get into this situation, and why do we think this
is common enough to address in Escrow. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)
Bugs this fixes:
(either VSO or GitHub links)
Workarounds, if any
Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW
Risk
This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code
Performance impact
(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")
Is this a regression from a previous update?
Root cause analysis:
How did we miss it? What tests are we adding to guard against it in the future?
How was the bug found?
(E.g. customer reported it vs. ad hoc testing)