Skip to content

Bring over a few changes from the TechEmpower repo #266

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

Closed
wants to merge 2 commits into from

Conversation

dougbu
Copy link
Contributor

@dougbu dougbu commented May 22, 2017

  • incorporate aspnet/FrameworkBenchmarks@4830e2fc, "Only Prepare DbCommand once"
  • enable more scenarios e.g. "--scenarios plaintext" also enables "mvc/plaintext" scenario
  • optimize Content-Length setting in plaintext scenario
  • remove unused Microsoft.EntityFrameworkCore.Design dependency and EF tooling
  • remove irrelevant #if NET46 code

nits:

  • sort dependencies
  • clean up whitespace
  • accept VS suggestions

- incorporate aspnet/FrameworkBenchmarks@4830e2fc, "Only Prepare DbCommand once"
- enable more scenarios e.g. "--scenarios plaintext" also enables "mvc/plaintext" scenario
- optimize `Content-Length` setting in plaintext scenario
- remove unused Microsoft.EntityFrameworkCore.Design dependency and EF tooling
- remove irrelevant `#if NET46` code

nits:
- sort dependencies
- clean up whitespace
- accept VS suggestions
Copy link

@cesarblum cesarblum left a comment

Choose a reason for hiding this comment

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

enable more scenarios e.g. "--scenarios plaintext" also enables "mvc/plaintext" scenario

Does this mean when I run the driver with -n plaintext I'll be getting more than one job run?


// HACK: Setting the Content-Length header manually avoids the cost of serializing the int to a string.
// This is instead of: httpContext.Response.ContentLength = payloadLength;
response.Headers["Content-Length"] = "13";

Choose a reason for hiding this comment

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

What is the perf difference?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to keep the code in Benchmarks: 19ecf5e

Copy link
Contributor

@benaadams benaadams May 23, 2017

Choose a reason for hiding this comment

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

This would be a regression in 2.0 with the add ContentLength to IHeaderDictionary changes; the hack is fixed and no longer needed (and becomes a regression)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🆗 I'll undo this here and fix the TechEmpower code.

Copy link
Contributor

@benaadams benaadams May 23, 2017

Choose a reason for hiding this comment

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

You don't want to fix the TechEmpower until it uses 2.0 though.

Copy link
Contributor

Choose a reason for hiding this comment

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

TechEmpower is being updated to target .NET Core 2.0.0-preview1.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hooray! 😄

{
EnableDefault();
return 2;
}

var props = typeof(Scenarios).GetTypeInfo().DeclaredProperties
.Where(p => string.Equals(partialName, "[all]", StringComparison.OrdinalIgnoreCase) || p.Name.StartsWith(partialName, StringComparison.OrdinalIgnoreCase))
.Where(p => string.Equals(partialName, "[all]", StringComparison.OrdinalIgnoreCase) || p.Name.IndexOf(partialName, StringComparison.OrdinalIgnoreCase) >= 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

We want to keep StartsWith: c22b982

If anything I would update TechEmpower to also use StartsWith.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shoot that's going to break many of the TechEmpower scripts but I understand the "enable the minimum" motivation. ☹️ but 🆗

@@ -17,7 +16,6 @@
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why this can/should be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

… because databases are automatically created in all cases. No need for dotnet ef database update, migration management, et cetera.

</ItemGroup>

<ItemGroup>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why this can/should be removed?

@@ -40,7 +40,7 @@ public DapperDb(IRandom random, DbProviderFactory dbProviderFactory, IOptions<Ap
async Task<World> ReadSingleRow(DbConnection db)
{
return await db.QueryFirstOrDefaultAsync<World>(
"SELECT id, randomnumber FROM world WHERE Id = @Id",
"SELECT id, randomnumber FROM world WHERE id = @Id",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was required for compat with a particular DB or driver, but either way it seems better all-lowercase.


// HACK: Setting the Content-Length header manually avoids the cost of serializing the int to a string.
// This is instead of: httpContext.Response.ContentLength = payloadLength;
response.Headers["Content-Length"] = "13";
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to keep the code in Benchmarks: 19ecf5e


// HACK: Setting the Content-Length header manually avoids the cost of serializing the int to a string.
// This is instead of: httpContext.Response.ContentLength = payloadLength;
response.Headers["Content-Length"] = "13";
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a regression in 2.0 with the add ContentLength to IHeaderDictionary changes

"React to IHeaderDictionary ContentLength change" #170
"[Perf] Add ContentLength to IHeaderDictionary" aspnet/HttpAbstractions#757
"Use ContentLength as primary data source" aspnet/KestrelHttpServer#1313

- enable more scenarios e.g. "--scenarios plaintext" also enables "mvc/plaintext" scenario
  - stick with enabling the minimum
- optimize `Content-Length` setting in plaintext scenario
  - wasn't an optimization
@dougbu
Copy link
Contributor Author

dougbu commented May 23, 2017

fc92496

@dougbu dougbu closed this May 23, 2017
@dougbu dougbu deleted the dougbu/rationalizations branch May 23, 2017 22:06
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.

5 participants