3

Closed

Cache the compiled expression to improve performance

description

[Performance] When the OData [Queryable] logic composes the query, it currently converts simple IEnumerable's to IQueryable using Enumerable.AsQueryable() when building the query expression. But performance tests have shown an expression like 'customers.where()" runs 10x faster than "customers.AsQueryable().where()" when 'customers' is a simple IEnumerable<Customer>.

If the controller action really did return a simple IEnumerable, the query execution logic should respect that and avoid converting using AsQueryable() unnecessarily. This will benefit primarily LinqToObjects() applications
Closed Dec 13, 2012 at 9:52 PM by HongmeiG
LinqToObject is not a common scenario. We are working on the performance for Queryable based on EF instead.

comments

HongmeiG wrote Aug 30, 2012 at 9:41 PM

We can avoid calling AsQueryable if the instance is of type IEnumerable.

HongmeiG wrote Oct 10, 2012 at 10:45 PM

Once you made the IQ change, this will not be applicable any more since we always demand it to be IQ.

HongmeiG wrote Oct 10, 2012 at 10:58 PM

Change title to reflect the real optimization.