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

Performance compared to EF6.Extended #113

Open
ksmithRenweb opened this issue Jan 30, 2017 · 12 comments
Open

Performance compared to EF6.Extended #113

ksmithRenweb opened this issue Jan 30, 2017 · 12 comments
Assignees

Comments

@ksmithRenweb
Copy link
Contributor

Performance as always is a broad issue but it is the key as to why a query batching library is so useful.
In some cases the queries don't need to be batched. In those cases, performance shouldn't be significantly different.

After that, here are the results of some performance testing. All these calls were averaged over a 100 runs. After running once to make sure the assemblies are loaded. All these calls have multiple joins. All these calls reached out to a sql server out on the network but it was the same db for all the calls. So the latency should be equivalent for all of them.

image

@JonathanMagnan JonathanMagnan self-assigned this Jan 31, 2017
@JonathanMagnan
Copy link
Member

Hello @ksmithRenweb ,

Thank you for reporting this benchmarks, but I'm not sure what you are seeking with this thread.

Is there a question?

Best Regards,

Jonathan

@ksmithRenweb
Copy link
Contributor Author

Then what I am seeking is that there would not be a significant performance loss when using your future framework. In the case where only a single call query is made, there is a significant performance loss.
There should be a way for you to go, "if only 1 call is batched, skip all this extra logic and let EF Core make the call."

@JonathanMagnan
Copy link
Member

Thank you,

That is very clear now ;)

@ksmithRenweb
Copy link
Contributor Author

I've issued a PR on some changes I authored. The changes eliminate the performance problem.

image

@JonathanMagnan
Copy link
Member

Hello @ksmithRenweb ,

Thank a lot for the help.

Tomorrow I should have enough free time to verify & merge your PR. I will try to make some optimization as well.

Best Regards,

Jonathan

@JonathanMagnan
Copy link
Member

Hello @ksmithRenweb ,

The v1.4.26 has been released.

Thank you for your contribution. We removed the need for the interface in your PR, but we kept the rest of your code.

Let me know about new performance. It should be similar to the PR you provided.

Best Regards,

Jonathan

@ksmithRenweb
Copy link
Contributor Author

ksmithRenweb commented Feb 13, 2017 via email

@ksmithRenweb
Copy link
Contributor Author

having reading difficulties this morning.
1.4.26 will be reviewed internally today.

@JonathanMagnan
Copy link
Member

It's Monday ;)

@ksmithRenweb
Copy link
Contributor Author

Tested 1.4.28. Performance is similar to my last test.
What amuses me is performance is a little better in some of the cases than base EF Core. Makes me wonder but will probably be a week or two before I go looking for a reason why.

I consider this issue closed.
Have a good week.

@ksmithRenweb
Copy link
Contributor Author

While looking at the code. I think you need to shift a few lines around to maintain InMemory support.

Currently:
if (Queries.Count == 1)
{
Queries[0].GetResultDirectly();
Queries.Clear();
return;
}

#if EF5 || EF6
var connection = (EntityConnection) Context.Connection;
#elif EFCORE
if (IsInMemory)
{
foreach (var query in Queries)
{
query.ExecuteInMemory();
}
return;
}

So in the case where there is only 1 query and its an in memory. there will be an error.

@JonathanMagnan
Copy link
Member

Hello @ksmithRenweb ,

You are right, thank you.

I also added the Queries.Clear() before the return.

What amuses me is performance is a little better in some of the cases than base EF Core

That is often due to how benchmark has been created. Sometimes, only a very small mistake can make the difference.

By example, if you make tests on EF Core before EFE Future, the first call made on EF Core will create and cache the query. All subsequent call (including our library) will use the cached version.

Best Regards,

Jonathan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants