Skip to content

Add console runner for measuring Blazor perf on desktop interpreter #24469

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

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

SteveSandersonMS
Copy link
Member

This is the runner I've been using for capturing profiling data for rendering scenarios. It takes our existing benchmark scenarios (well, just the grid ones so far) and exposes them as a standalone console app that runs without involving any browser. It's just doing the .NET side of things, and discarding the resulting renderbatches since there's no DOM to apply them to. You can run this under different .NET runtimes to compare the execution times.

I've been running this under the Mono desktop interpreter, with the interpreter modified to capture instruction counts when we enter and exit methods. This produces a profile trace that can be loaded into Chromium's profile inspector UI. As a separate work item, we should talk about whether we could make this trace-capturing feature be built into the Mono interpreter for reals, possibly even working when running under webassembly. One tricky aspect of this is being confident that it won't worsen actual perf, since even an if (profilingIsEnabled) check might have an impact if we do it on every single method entry/exit, so if this is too problematic we might want to consider having a separate "profile enabled" build of the runtime. Maybe there's some fancier way to avoid the overhead when profiling isn't enabled, but that's all separate to this PR.

Even if the Mono interpreter never gets built-in a profile capture feature, this PR is still very useful because it makes it much simpler to use standard CoreCLR profiling tools or to compare Mono interpreter vs a JIT-capable runtime.

@SteveSandersonMS SteveSandersonMS added the area-blazor Includes: Blazor, Razor Components label Jul 31, 2020
@SteveSandersonMS SteveSandersonMS requested a review from a team July 31, 2020 13:07
Console.WriteLine("Refresh Time " + (t2 - t1).TotalMilliseconds);
}
return base.OnAfterRenderAsync(firstRender);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This event handler logic change has no impact on the benchmarks because they never called this code anyway. I'm just clearing it up a bit.

@SteveSandersonMS SteveSandersonMS self-assigned this Aug 3, 2020
@SteveSandersonMS
Copy link
Member Author

Ping to reviewers. @pranavkm ?

Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

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

As long as it works 👍

@SteveSandersonMS SteveSandersonMS merged commit 1885af9 into master Aug 3, 2020
@SteveSandersonMS SteveSandersonMS deleted the stevesa/add-blazor-perf-console-runner branch August 3, 2020 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants