[thelist] VBScript Arrays

Joshua Olson joshua at waetech.com
Wed Apr 17 15:42:01 CDT 2002


----- Original Message -----
From: "Warden, Matt" <mwarden at mattwarden.com>
Sent: Wednesday, April 17, 2002 3:41 PM
Subject: Re: [thelist] VBScript Arrays


> well, i'd imagine (especially if there are a lot of files, like in this
> case) that it would be a much better idea to store it in an array and
> cache that array in an application-level variable rather than making x
> calls to the OS for info for each of the many files.
>
> wow. that was a long sentence. but, don't you think?

Yes, that was a long sentence!  Storing large arrays of arrays in the
application scope may not be the most scalable option out there because it
forces the application to run in a single thread whenever the variable is
accessed.  While I can definitely agree that there are benefits to caching
some of the information (perhaps filename), I'm not sure I see the same
benefit to caching *all* the information about the files.

I'd be tempted to at least cache the filename, then load the file attributes
as necessary.  The benefit may even be more obvious if the system has a
paging mechanism.  It the page normally shows 10 of 100, then that is merely
10 calls to the OS for file information.  The OS should be able to return
the attributes for a file extremely quickly.

Most web developers have very little quarrel with doing a file include,
right?  In asp it's via a <!-- #include file="" -->, in CF it's <cfinclude
template="">.  Guess what, each of those calls asks the OS if the file
exists or has been modified.  A file exists query is not really anymore
expensive than an attributes query since all the information exists in the
FAT (or whatever the OS uses instead).

IOW, the benefits for not having a complex structure in a shared scope
(namely application) are going to far outweigh the penalties for making a
few simple calls to the OS for file attributes in the long run.

And that, is what I think.

-joshua





More information about the thelist mailing list