Performance Ideas

Apr 8, 2009 at 10:14 PM
This code represents probably the most informative and complete projects I have ever seen and it's a great instructional project to illustrate a custom Linq provider for database access.  That said, I wanted to discuss ideas for implementors for strategies to improve performance.  One thing I've noticed about the code is that overhead increases significantly as the number of properties on the record types grows.  This is probably because of the iterations through MemberInfo to work out the query.  In any case, I'd like to figure out some ways to maybe create some optimizations.  One idea might be to (optionally) stash hints inside the record types the system could use to more efficiently create the sql query with less reflection.  Any thoughts? 
May 7, 2009 at 8:38 AM
You can extend the QueryMapping class with a custom mapper that rules out simple reflection and use improved performance strategies. Some "better performance strategies" I have found are:
1. Cache the target class metadata through reflection, so that you use it just once.
2. Use dynamic code generation instead of reflection. These links will help you get started:

(The second link provides a library you can use.)

Hope this helps,
Vicente Almagro