DIR with Win2000 Pro is quick, WinXP Pro is slow

  • Thread starter Thread starter j.t.w
  • Start date Start date
J

j.t.w

Hi Everyone.

I have a form that retrieves and displays the image of a .tif file
inside of an image control.

strPath = "\\MyServer\Images\"
strFile = cboFilename

strDir = Dir(strPath & strFile)

I have a folder containing 10,000 .tif files (roughly 700MB total) on
our NT Server. Using Win 2000 machines it takes less than 2 seconds to
display the file. Using an XP machine, it takes about 25 seconds.

Could someone please tell me why displaying files using Windows 2000
Pro is so much quicker than with Windows XP Pro? Is there a way to
lessen the time for XP?

I do not think it is a networking problem because between the XP
workstations and the server, I have gigabit (1000 mbps) NIC's and a
gigabit switch. For the 2000 workstations, I only have 100 mbps NIC's.

If someone could help me with this problem, I'd appreciate it.

Thanks,
j.t.w
 
The XP setup likely does a lot more security settings, and has to authuncate
users. While I find that window XP boxes actually seem to transfer data
"faster" then previous versions of windows, they in fact take longer to
open/access the file. This is why so often you find that keeping a
persistent connection open from a access front end to a access back end can
do absolute incredible things for performance (by keeping the connection
open, you get the benefits of a good OS..and eliminate the security stuff
that occurs during a open). However, this "fix" does not apply to you.

I don't know how you load up your list of files to build the list, but you
could try the following code..it does run quite fast, and has the add
benefit of recusing sub-folders also......

Sub dirTest()

Dim dlist As New Collection
Dim startDir As String
Dim i As Integer

startDir = "C:\access\"
Call FillDir(startDir, dlist)

MsgBox "there are " & dlist.Count & " in the dir"

' lets printout the stuff into debug window for a test

For i = 1 To dlist.Count
Debug.Print dlist(i)
Next i

End Sub


Sub FillDir(startDir As String, dlist As Collection)

' build up a list of files, and then
' add add to this list, any additinal
' folders

Dim strTemp As String
Dim colFolders As New Collection
Dim vFolderName As Variant

strTemp = Dir(startDir)

Do While strTemp <> ""
dlist.Add startDir & strTemp
strTemp = Dir
Loop

' now build a list of additional folders
strTemp = Dir(startDir & "*.", vbDirectory)

Do While strTemp <> ""
If (strTemp <> ".") And (strTemp <> "..") Then
colFolders.Add strTemp
End If
strTemp = Dir
Loop

' now process each folder (recursion)
For Each vFolderName In colFolders
Call FillDir(startDir & vFolderName & "\", dlist)
Next vFolderName

End Sub
 
If you can, use the library "Microsoft Scripting Runtime". Is much
faster than vb/vba equivalent functions. Note that i've used late bound. I
declare variables as object and create objects using "CreateObject" tather
than "New Scripting.FileSystemObject". This way, i don't need the reference
to the library.

Dim fso as Object 'Scripting.FileSystemObject
Dim oFolder as Object 'Scripting.Folder
Dim oFile as Object ''Scripting.File

Set fso = CreateObject("Scripting.FileSystemObject")
set oFolder = fso.GetFolder(strFolderPath)
for each oFile in oFolder.Files
'Do anytings you want ...
Next oFile
 
I can't comment on the difference between Windows 2000 and Windows XP, but I
expect you would see significant performance improvements if you could split
the files up across multiple folders. If they can be categorized in some
way, you could ask the user to select the category (or infer it from other
controls on the form?) and then search only the folder for that category.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Wow!

That is much cleaner than what I had and it even does sub-folders.
Also, I did not know that you could call a function from code within
itself. I'll need to read up on "New Collection" as I've never used it
before. I got so much more to learn.

Thank you for sharing your insights, experience and code.

j.t.w
 
Ricardo,

Thank you for your reply.

I don't really understand what you mean by "use the library "Microsoft
Scripting Runtime" and "i don't need the reference to the library".

Is it, by using "CreateObject", the "Microsoft Scripting Runtime"
library is used automatically without referencing it?

Anyway, thanks again and I appreciate your help.

j.t.w
 
Brendan,

Thank you for your reply.

Though I do not really want to, This may be the only way to speed up
the retrieval of the image(s).

What is so funny is that on an older, slower machine with less ram and
less bandwidth, it is more that 10 times faster in displaying the
image. As a side note, browsing the image folder with Windows Explorer
using Win2000 takes about 5 seconds versus WinXP at 40 seconds.

Thanks again.
j.t.w
 
You might want to check your antivirus configuration on the newer, but slower, WinXP machine. Is
it configured to scan all files on your NT Server, whereas perhaps your older Win2000 machine is
not?

Tom
______________________________________

Brendan,

Thank you for your reply.

Though I do not really want to, This may be the only way to speed up
the retrieval of the image(s).

What is so funny is that on an older, slower machine with less ram and
less bandwidth, it is more that 10 times faster in displaying the
image. As a side note, browsing the image folder with Windows Explorer
using Win2000 takes about 5 seconds versus WinXP at 40 seconds.

Thanks again.
j.t.w
 
"Is it, by using "CreateObject", the "Microsoft Scripting Runtime"
library is used automatically without referencing it?"

Exact.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top