asp.net MVC and $.ajax added performance overhead

前端 未结 1 907
借酒劲吻你
借酒劲吻你 2020-12-19 09:22

I have stumbled across a very curious issue of poor performance when asp.net MVC control is called by jquery $.ajax function. The control performs a database action that tak

1条回答
  •  天命终不由人
    2020-12-19 09:52

    I found the issue and the issue IS with the database call. However, the reason I was at first misled is the piece of code that calculates the time difference.

    DateTime start = DateTime.Now;
    
    SearchResult myReportsResult = _repository.GetResults(searchCriteria);  
    
    
    DateTime got_it = DateTime.Now; 
    TimeSpan diff = (got_it - start);
    int diff_ms = diff.Milliseconds;
    

    This code did not give me the correct milliseconds value.

    0 讨论(0)
提交回复
热议问题