Skip to content
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

Fix benchmarks to produce correct documents #8072

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

DustinCampbell
Copy link
Member

This change cleans up ProjectSnapshotManagerBenchmarkBase a bit, which is the base class of several of the tooling benchmarks. While cleaning this up, I was surprised to find a bug where several documents with initialized with a file path as the text, rather than the actual file text. This results in some benchmarks, notably BackgroundCodeGenerationBenchmark, being completely invalid.

@DustinCampbell DustinCampbell requested a review from a team as a code owner January 4, 2023 17:42
for (var i = 0; i < 4; i++)
{
var filePath = Path.Combine(projectRoot, "Views", "Home", $"View00{i % 4}.cshtml");
var text = SourceText.From(filePath, encoding: null);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪲 A SourceText is created using the file path as the text.

@@ -1,16 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root for license information.

#nullable disable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@DustinCampbell DustinCampbell merged commit 92982d0 into dotnet:main Jan 4, 2023
@DustinCampbell DustinCampbell deleted the benchmarks branch January 4, 2023 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants