aspnet/EntityFramework — pull request #1325 by rowanmiller (2014-12-23 23:43:24+00:00)
Title: Query perf tests (with EF6 comparison)

Changes:
* Removing previous 'QueryExecutionPerf' tests that were ported from EF6 test suite
* Replacing with Query tests that better represent recommended coding patterns (new tests cover the same general patterns that were covered by previous tests)
* Adding EF6 equivalent of the new tests (for comparison)
* Moved the Customer/Orders/Products model to a shared location since it seems this simple model will be helpful between many tests without needing to change the model. Each set of tests still create their own database with a set of expected data that is tailored to that set of tests.

I considered sharing the POCO classes between EF6/7 tests but felt that makes the tests a little different if the EF6 ones are accessing entity types from a different assembly. We could look at having a shared assembly in the future... but doesn't seem worth it for 4 classes.

___

Here are some rough results from my laptop. **I think the slower perf on EF7 is probably due to two things we already knew (and already have items tracking)**:
* [Lack of query cache](https://github.com/aspnet/EntityFramework/issues/1147) (probably explains the not so pronounced differences)
* [Relationship fixup](https://github.com/aspnet/EntityFramework/issues/446) (and state manager in general) seems to be the biggest bottleneck which is why the numbers are more pronounced on the Include test. I also saw this in the seed data code - where I've currently used different context instances to save each type to avoid fixup.

Test | EF6 | EF7
------------ | ------------- | -------------
Query_Simple_LoadAll | 26 ms | 367 ms
Query_Simple_Where | 18 ms | 138 ms
Query_Simple_OrderBy | 24 ms | 339 ms
Query_Simple_SkipTake | 19 ms | 154 ms
Query_Simple_Projection | 4 ms | 39 ms
Query_Simple_ProjectionAcrossNavigation | 8 ms | 41 ms
Query_Simple_Count | 2 ms | 12 ms
Query_Simple_Include | 147 ms | 12537 ms
Query_Simple_GroupBy | 41 ms | 54 ms
Query_Funcletization_SameQueryInstance | 66 ms | 1227 ms
Query_Funcletization_NewQueryInstance | 90 ms | 15166 ms
Query_Funcletization_ValueFromObject | 108 ms | 1327 ms