Hard drive performance testing

johngalt47

n00b
Joined
Nov 28, 2006
Messages
32
I have several drives in my computer and wrote a little program to test their performance against the performance of the drives in my office computers.

What I don't understand is why all the drives in my home computer test the same. Here is the VBA code I use. It creates a nearly 1 gigabyte file and takes about 38 seconds no matter which drive I write to.
========================================================
Private Sub StartBtn_Click()

Dim str1 As String
Dim x As Long
Dim start_Time
Dim stop_Time
Dim Total_Time

start_Time = Time

StartTimeLabel.Caption = start_Time

Open "j:\OutFile.txt" For Output As #1

For x = 1 To 6736832

str1 = "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789"

Write #1, str1

Next x

Close #1

stop_Time = Time
StopTimeLabel.Caption = stop_Time
Total_Time = stop_Time - start_Time

Debug.Print stop_Time
Debug.Print start_Time
Debug.Print Total_Time
End Sub
==========================================================

Anyone have ideas about this?
 
I'm no expert here, but I would suspect your problem is using a 4gl scripting language to test hardware performance, and with small chunks of character i/o to boot. You are probably limited in throughput by your programing language. If you write it in "C" you should see some differences between the machines. You wouldn't need more lines than you have for your VB app.

If you change from character I/O to binary I/O you will see a much greater performance jump. If you want to see if there is a difference, either get hdtune (works quite nicely and gives pretty graphs) or download a linux live CD with bonnie and test your different drives. Bonnie uses both character i/o and block i/o to see what CPU overhead you generate on each type of write based on the disk/controller technology. You can also use a modern version of "dd", that will give you either a throughput or time... Byte aligned transfers are always faster than non aligned. You may get some performance boost by using 2k or 4k blocks. Memory page alignment counts if you are actually reading this into or out of ram for some reason.

Also, I would make the file a multiple of system memory to negate disk cache effects... I.E. If you have 1 gig of RAM, you probably need to write out a 2 gig file, that would be about 2-4x the ram committed for "OS/cache" in windows.
 
As was pointed out, writing a small character string (why 145 characters?) will not help performance. Make a much larger buffer to be written (at least 4k), and make sure that it's an array of bytes, not an array of characters---otherwise you may be doing extra Unicode stuff each time.
 
Back
Top