aspnet / Mvc

[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
5.62k stars 2.14k forks source link

Misc style cleanup and adding 2 more benchmarks #8771

Closed rynowak closed 5 years ago

rynowak commented 6 years ago

A few minor changes for simplification and bringing things in line with our code style.

Also adding benchmarks here that attempt to simulate what @helper codegen would do (both sync and async).

/cc @DamianEdwards @m0sa @nickcraver

rynowak commented 6 years ago

BenchmarkDotNet=v0.10.13, OS=Windows 10.0.17763
Intel Xeon CPU E5620 2.40GHz, 1 CPU, 4 logical cores and 4 physical cores
.NET Core SDK=3.0.100-preview-009750
  [Host]     : .NET Core 3.0.0-preview1-26907-05 (CoreCLR 4.6.26907.04, CoreFX 4.6.26907.04), 64bit RyuJIT
  Job-HUYTCC : .NET Core 3.0.0-preview1-26907-05 (CoreCLR 4.6.26907.04, CoreFX 4.6.26907.04), 64bit RyuJIT

Runtime=Core  Server=True  Toolchain=.NET Core 3.0  
RunStrategy=Throughput  
Method ViewPath Mean Error StdDev Op/s Gen 0 Gen 1 Allocated
RenderView ~/Views/HelperDynamic.cshtml 113.33 us 2.2368 us 3.1357 us 8,823.6 0.3662 0.1221 22.62 KB
RenderView ~/Views/HelperExtensions.cshtml 78.15 us 1.5593 us 3.9120 us 12,795.7 0.2441 0.1221 28.9 KB
RenderView ~/Views/HelperPartialAsync.cshtml 770.84 us 14.5555 us 13.6152 us 1,297.3 1.9531 0.9766 182.62 KB
RenderView ~/Views/HelperPartialSync.cshtml 826.26 us 16.4214 us 19.5485 us 1,210.3 2.9297 0.9766 182.62 KB
RenderView ~/Views/HelperPartialTagHelper.cshtml 1,177.60 us 32.1279 us 31.5539 us 849.2 1.9531 - 216.18 KB
RenderView ~/Views/HelperSyntheticAsync.cshtml 43.87 us 0.8513 us 0.9462 us 22,795.7 0.1221 0.0610 10.79 KB
RenderView ~/Views/HelperSyntheticSync.cshtml 44.65 us 0.9041 us 1.5834 us 22,397.7 0.1221 0.0610 10.79 KB
RenderView ~/Views/HelperTyped.cshtml 89.35 us 1.6915 us 1.8099 us 11,192.5 0.2441 - 22.62 KB

The new benchmarks I added are similar to what I anticipate we would codegen if we introduced an equivalent feature to @helper. I'll discuss this in more detail in on the issue https://github.com/aspnet/Razor/issues/274

mkArtakMSFT commented 5 years ago

Thanks for your effort, @rynowak. As part of the effort to reduce number of repos (https://github.com/aspnet/Announcements/issues/330) we're closing all the PRs in this repo. Please reopen this PR against the AspNetCore repo so we can consider it.