Open toptensoftware opened 13 years ago
Profiler is pointing at this in ExecutionBuilder.cs:
// this sucks, but since we don't track true SQL types through the query, and ADO throws exception if you
// call the wrong accessor, the best we can do is call GetValue and Convert.ChangeType
Expression value = Expression.Convert(
Expression.Call(typeof (Convert), "ChangeType", null,
Expression.Call(reader, "GetValue", null, Expression.Constant(iOrdinal)),
Expression.Constant(TypeHelper.GetNonNullableType(column.Type), typeof(Type))
),
column.Type
);
We're trying to sort out why some of our web pages are burning so much CPU and seem to have narrowed it down to SubSonic's LINQ implementation.
Using the standard T4 templates (although probably somewhat older version of the templates) I've found that running a simple SingleOrDefault query can be about 20x times slower than an equivalent CodingHorror query.
myrecord.SingleOrDefault(x=>x.name=="blah") = 200,000 ticks
CodingHorror("SELECT * FROM myrecords WHERE name=@p", "blah).ExecuteTypedList()[0] = 10,000 ticks.
This seems a pretty harsh performance hit and I'm wondering if this is typical and has it been improved in later versions of SubSonic (we're using a somewhat older build because we can't get the latest to work).
btw: Also, I found that I could improve SingleOrDefault in the generated template by replacing the Count() and ExecuteTypedList() with results.SingleOrDefault(). This took about 100,000 ticks.
We're running under .NET/Windows/MySQL.