I'm using Visual Studio 2010's built-in profiler to look at a section of poorly performing code. However, I'm seeing some results that don't quite make sense. Here is a shot of the report:
This seems to indicate that Regex.Replace is the bottleneck (and I should therefore try to reduce or eliminate this use as much as possible). However, this feels inaccurate, as I know that this particular section of code is making heavy use of the database, and thus I would expect the SqlCommand.ExecuteNonQuery to be at least a little higher in this report, if not more dominant than the Regex use.
So, my question is: is this profiler tool useless for anything involving database access, since the SQL work is being done by another process (i.e. the SQL server), and therefore I have to measure it some other way?