Skip to content
Tcl Source Code View Ticket
Login

View Ticket

(WIN32)File stat calls in large dirs are up to 100x faster

Closed / Fixed403001ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 25 years ago
andreas_kupriesplain2001-01-02 18:07:05
Note: Right now the supplied patch is a "reverse patch" (i.e. it describes how to go from the new version of the code back to the original/old code before the fix).
nobodyplain2001-02-02 23:38:47
The Windows version of 'glob' also needs to get a file's attributes (when the -types flag is given), and seems to call a similar set of APIs to the old stat.  It could probably also benefit from being updated with similar code to this patch.
dgp Ticket [403001ffff]: 1 change [History diff]2001-02-22 07:01:52
hobbsplain2001-03-24 08:56:06
Logged In: YES 
user_id=72656

I've applied and reversed the patch.  It does pass test 
suite on Win2K, but the patch might not take into account 
the Win9* handling of unicode.  Also, what is really 
getting sped up?  I see 'file stat 
$dirWith1000filesAnd1000dirs s' go from 120 usec to 79 
usec, but nothing like 100x...
hobbsplain2001-03-24 08:56:07
File Added - 4586: 403001.patch
hobbsplain2001-03-24 08:57:10
File Added - 4587: 403001.patch

Logged In: YES 
user_id=72656

I've applied and reversed the patch.  It does pass test 
suite on Win2K, but the patch might not take into account 
the Win9* handling of unicode.  Also, what is really 
getting sped up?  I see 'file stat 
$dirWith1000filesAnd1000dirs s' go from 120 usec to 79 
usec, but nothing like 100x...
hobbsplain2001-03-24 08:57:43
File Added - 4588: 403001.patch

Logged In: YES 
user_id=72656

I've applied and reversed the patch.  It does pass test 
suite on Win2K, but the patch might not take into account 
the Win9* handling of unicode.  Also, what is really 
getting sped up?  I see 'file stat 
$dirWith1000filesAnd1000dirs s' go from 120 usec to 79 
usec, but nothing like 100x...
vincentdarleyplain2001-08-13 04:01:17
Logged In: YES 
user_id=32170

The code this patches has changed considerably in Tcl 
8.4a3, so we need to work out whether we can still apply 
this technique (I would assume so, but the patch will be 
very different).
vincentdarleyplain2001-09-17 17:33:24
Logged In: YES 
user_id=32170

Replying to Jeff below.  This patch probably won't work 
properly in Win9*.  The patch uses GetFileAttributesExW 
which has a companion GetFileAttributesExA 

Probably the best way is to replace:

(*tclWinProcs->getFileAttributesProc)

which calls the non-Ex functions GetFileAttributesW/A) with 
the 'Ex' functions.  This requires changes to the 20 
locations in tcl/win which use the old function.

Alternatively, we could add a new 'Ex' entry to 
*tclWinProcs and use that here.  Then the rest of the code 
could be slowly migrated to the faster API.

I haven't tested out or read anything on how much faster 
this new API is supposed to be.
hobbs Ticket [403001ffff]: 1 change [History diff]2001-10-17 06:00:22
vincentdarleyplain2001-11-27 17:19:03
Logged In: YES 
user_id=32170

Recent filesystem changes to improve vfs support on 
Win95/98 (removing a 30-second startup delay with tclkit!) 
have introduced something like this patch, in a way which 
works even when the new APIs are not available (e.g. Win95).

Therefore I'm closing it.
Log in (anonymous is fine) to add a comment.

Attachments: