Before we can start testing, we need a means of extracting useful information from those tests. For our first experiments that measure data access performance, we'll adopt a straightforward technique that uses a simple plan. We'll:
Subtracting one DateTime object from another results in a TimeSpan object. This exposes a TotalMilliseconds() method that returns the number of milliseconds in the time span. (Even in this era of GHz CPUs, milliseconds are a precise enough measure of performance.) The code we'll be using to test performance will therefore look something like this:
Dim startTime As DateTime Dim howLong As TimeSpan Dim result As String startTime = DateTime.Now ' Perform database task to monitor here howLong = DateTime.Now.Subtract(startTime) result = String.Format("{0} ms", howLong.TotalMilliseconds)
The results of performance tests like these - especially in one-off trials - should not be viewed as gospel. To determine the results in this chapter, each test was run several times in order to reduce the chances of an external process interfering with performance. The numbers should be compared relative to one another, and certainly do not reflect every environment; the machine used to generate the performance numbers for this chapter was a 1.2GHz PIII with 1GB of RAM. |