Slow Extension

I have this code in an extension that I'm using and I keep getting "Slow Extension".  Can someone explain why its considered slow?  To me it seems like pretty simple code and shouldn't be causing issues.

public void MssDaysInMonth(int ssYear, int ssMonth, out int ssNumOfDays) {
            ssNumOfDays = System.DateTime.DaysInMonth(ssYear, ssMonth);
        } // MssDaysInMonth
Hi Rebecca,

The SlowExtension warning is displayed when executing a certain extension action takes more than a predefined amount of time (I'm not really sure what it is, 500ms maybe?). Still, I agree that the code you're executing isn't really intensive.

Other reasons for it might be:

- The machine is under a heavy load at that time, so the action takes time;
- There's a memory shortage for all the applications that are running, and the OS process of using virtual memory is what's taking up most of the time;
- Something related to the ASP.Net working process or .Net Framework prepping up for executing that action.

Does this happen often? Was it just at that time? And is that the only warning that's being logged? What about in Windows Event Viewer?

One way for you to go one level deeper is to add a log action that records the time before and after the DateTime.DaysInMonth action, in the extension. That way you could actually measure how long it's taking you to execute the code actually inside the extension - though, to be honest, I don't feel that it will be much.

Let us know more about it.


Paulo Tavares