Tcl Source Code

View Ticket
Login
Ticket UUID: 403001
Title: (WIN32)File stat calls in large dirs are up to 100x faster
Type: Patch Version: None
Submitter: nobody Created on: 2000-12-22 09:42:10
Subsystem: 36. Pathname Management Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-11-27 17:19:03
Resolution: Fixed Closed By: vincentdarley
    Closed on: 2001-11-27 10:19:03
User Comments: vincentdarley added on 2001-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.

vincentdarley added on 2001-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.

vincentdarley added on 2001-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).

hobbs added on 2001-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...

hobbs added on 2001-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...

hobbs added on 2001-03-24 08:56:07:

File Added - 4586: 403001.patch

hobbs added on 2001-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...

nobody added on 2001-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.

andreas_kupries added on 2001-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).

Attachments: