"Mark Schupp" <no******@email .net> wrote in message news:<um******* *******@TK2MSFT NGP11.phx.gbl>. ..
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** ***@posting.goo gle.com...I have a page that produces little thumbnails of the 3D models it
finds in a specified directory (and iterates down through any sub
directories).
It basically scans each directory for 3D Studio Max files using the
filesystemobjec t and writes an activeX component called iDrop for each
file so it can be displayed on the page (and drag-dropped straight
into Max). If it happens to find a similarly named XML file in the
directory, it loads that and transforms the content with a pre-loaded
XSL stylesheet to provide a summary of the model's size/face
count/etc. This is just for context though, just in case it is
relevant.
Rename the "slow" file, then make a copy of the "fast" file with the "slow"
file name. Is it still slow?
The file with the "slow" name becomes slow. The one that was slow
becomes fast :) This kinda proves that it's something IIS is doing
when executing the code. The same thing happens with a second page in
the same directory that is used as a detailed view for a particular
model. Again, making a new file with a new name speeds up the code,
but the slowdown is associated with the filename and not the code
itself.
Are you calling both files exactly the same way (by a link, form post, etc)?
If you are calling by a link or form post swap the links and see if the
performance problem follows the link.
I'm typing in a direct URL to the page with the same parameter (a
directory
path to scan) for each.
Patrice wrote:
Have you found where exactly the time difference is ?
Inserting more timing checks makes it clear that one page is taking
around 2 seconds to run through the files in a directory, the other
<0.2 seconds. Specifically, it's taking a long time to get a file's
name. The code makes repeated use of objFile.Name. Caching this name
in a string (which I should have been doing anyway, doh) speeds up
BOTH pages immensely, but the slow down factor for the files is still
around 16 to 1. So it's the FileSystemObjec t that's got the problem.
Why would getting a file name be so slow?
For now it looks like to me that you see fast running server side code
under all circumstances.
Nope - the timings are being done on the server side, the activeX
loads
the models clientside, so won't slow down the execution of the ASP.
If yes, you could try to donwload only those models the user actually
wants to use...
Point taken, but this is a model library browser - they don't know
what
model they are looking for, they are browsing, say, 100 office chairs
looking
for the right one for the scheme they are modelling.
Hmm. It looks like IIS has cached something to do with the page's
name that
isn't getting reset when the page is edited. I'll try restarting the
IIS server, but if that fails I'm assuming the IIS metabase has got
corrupted for the files that were in that directory, but it's beyond
me what it might have cached that affects behaviour in this way.
Here's the code for the loop that is being so slow:
(splittime is my debug code that logs the elapsed time in milliseconds
for each call, and writeGalleryMod el just outputs the HTML based on
the available files, fso is a global fileSystemObjec t)
sub listmodelsunder (libraryroot, librarywebroot, subpath, preview)
dim thisFolder, subFolder, file
dim bestproxyfile
dim proxyfile
dim xmlfile
dim maxfile
dim vrmlfile
dim filename
set thisfolder = fso.GetFolder(l ibraryroot & subpath)
proxyfile = ""
xmlfile = ""
maxfile = ""
vrmlfile = ""
splittime(libra ryroot & subpath)
for each file in thisFolder.File s
filename = file.Name 'THIS IS THE CALL THAT TAKES 16 TIMES LONGER
ON ONE PAGE
splittime(filen ame & " start")
select case fileextension(f ilename)
case "jpg"
if proxyfile = "" then proxyfile = filename
if instr(1,filenam e,"best",1) > 0 then bestproxyfile =filename
if instr(1,filenam e,preview,1) > 0 then proxyfile = filename
case "max"
if maxfile = "" then
maxfile = filename
else
if filename = thisFolder.Name & ".max" then
maxfile = filename
end if
end if
case "xml"
if instr(1,filenam e,"fileproperti es",1) > 0 then xmlfile =
filename
case "wrl"
if vrmlfile = "" and preview = "3d" then vrmlfile = filename
end select
splittime(filen ame & " end")
next
splittime("scan complete")
if proxyfile = "" or preview = "3d" then proxyfile = bestproxyfile
if maxfile<>"" then 'this directory is a model, list it
writeGalleryMod el library & subpath, librarywebroot & subpath,
proxyfile, maxfile, xmlfile, vrmlfile
modelcount = modelcount + 1
else
for each subFolder in thisFolder.subF olders
listmodelsunder libraryroot, librarywebroot, subpath & "/" &
subFolder.Name, preview
next
end if
set thisfolder = nothing
end sub