I have an applicantion I am peforming an analysis on.When it completes, the only expensive area ths far was the login function that comes in at 57.6%. The calling function is 59.4% and the firstOrDefault is 56.4% according to my .dll.
The namespace that is marked as a huge flame, which is the icon on the left side once your analysis is done in the "Hot Path" function Name, is this...
Why is it so expensive and how do I fix this? Thank you in advance.
PS. I am in debug mode.
See obfuscated code.
Public Overridable Function GetUserByLogin(ByVal loginName As String, ByVal password As String) As Customer
Using db As New entities
Dim user = (From r In db.tbl_user
Where r.login_name = loginName And r.password = password
Select New Customer With {._mUserID = CInt(r.pk_user_id)}).FirstOrDefault()
If user IsNot Nothing Then
'If MyBase.mUserID <> 0 Then
user._specifics= getspecifics(user.mUserID)
'End If
End If
Return user
End Using
End Function
Try using the Entity Framework profiler along your .NET profiler. When you are using EF you should ALWAYS use the EF Profiler besides it. If you don't you might end up with a shit load of performance issues and loads and loads of queries.
i can run sql profiler to see what the compiled query will be. i understand that i can fix this by changing the request into a stored procedure but I am just wondering what vs 2012 is analyzing and how it comes to this conclusion.
I checked your link and it is another good piece of software that can help loads. Will look into it...
Xequence
Contributor
4313 Points
1528 Posts
vs 2012 --> analyze --> start performance analysis
Dec 20, 2012 09:49 PM|LINK
I have an applicantion I am peforming an analysis on.When it completes, the only expensive area ths far was the login function that comes in at 57.6%. The calling function is 59.4% and the firstOrDefault is 56.4% according to my .dll.
The namespace that is marked as a huge flame, which is the icon on the left side once your analysis is done in the "Hot Path" function Name, is this...
System.Linq.Queryable.FirstOrDefault(class Syste.inq.IQueryable`1<!!0>)
System.Core.ni.dll
Why is it so expensive and how do I fix this? Thank you in advance.
PS. I am in debug mode.
See obfuscated code.
Public Overridable Function GetUserByLogin(ByVal loginName As String, ByVal password As String) As Customer Using db As New entities Dim user = (From r In db.tbl_user Where r.login_name = loginName And r.password = password Select New Customer With {._mUserID = CInt(r.pk_user_id)}).FirstOrDefault() If user IsNot Nothing Then 'If MyBase.mUserID <> 0 Then user._specifics= getspecifics(user.mUserID) 'End If End If Return user End Using End FunctionCredentials
m.koopman
Participant
1372 Points
294 Posts
Re: vs 2012 --> analyze --> start performance analysis
Jan 02, 2013 01:53 PM|LINK
Try using the Entity Framework profiler along your .NET profiler. When you are using EF you should ALWAYS use the EF Profiler besides it. If you don't you might end up with a shit load of performance issues and loads and loads of queries.
http://www.hibernatingrhinos.com/products/efprof
Please mark my reply as answer if you found it help full
Xequence
Contributor
4313 Points
1528 Posts
Re: vs 2012 --> analyze --> start performance analysis
Jan 02, 2013 04:53 PM|LINK
i can run sql profiler to see what the compiled query will be. i understand that i can fix this by changing the request into a stored procedure but I am just wondering what vs 2012 is analyzing and how it comes to this conclusion.
I checked your link and it is another good piece of software that can help loads. Will look into it...
Credentials
m.koopman
Participant
1372 Points
294 Posts
Re: vs 2012 --> analyze --> start performance analysis
Jan 02, 2013 06:03 PM|LINK
Reason i gave you that link was because my geuss would be its not the actual FirstOrDefault but the query that is being preformed.
Please mark my reply as answer if you found it help full