Tcl Source Code

View Ticket
Login
Ticket UUID: 682500
Title: speed up filesystem patch
Type: Patch Version: None
Submitter: vincentdarley Created on: 2003-02-07 19:02:00
Subsystem: 37. File System Assigned To: vincentdarley
Priority: 7 High Severity:
Status: Closed Last Modified: 2003-02-12 01:56:25
Resolution: Accepted Closed By: hobbs
    Closed on: 2003-02-11 18:56:25
Description:
Here's a first cut at a patch which should speed up 
the filesystem in Tcl 8.4.1.  At least on Windows, 
with this patch Tcl 8.4 is faster in things like:

foreach f [glob -dir $dir *] {
   file stat $f arr
   ...
}

than 8.3, often by a quite a large margin.

I have also attached a file testfs.tcl which I am 
using for benchmarking.

It is untested on Unix.
User Comments: hobbs added on 2003-02-12 01:56:25:
Logged In: YES 
user_id=72656

Let's call this closed and have any bugs introduced be 
reported separately.

vincentdarley added on 2003-02-12 00:28:12:
Logged In: YES 
user_id=32170

NB. Jeff has now committed a fixed patch.  We shall see 
if any new bugs turn up over the coming week or two.

hobbs added on 2003-02-11 09:27:09:

File Added - 42057: fs4-682500.diff

Logged In: YES 
user_id=72656

And one more time in full (fs4) to make it easy for others ...

hobbs added on 2003-02-11 09:25:28:

File Deleted - 42054: 



File Added - 42055: fs3.1-682500.diff

Logged In: YES 
user_id=72656

Attaching same patch with correct -u formatting this time.

hobbs added on 2003-02-11 09:24:11:

File Added - 42054: fs3.1-682500.diff

Logged In: YES 
user_id=72656

And attached is a patch to fs3-682500.diff that corrects the 
failing test.  However, the entire handling of cwdLen, adding 
and subtracting 1 seems incorrect.  For example, 
Tcl_FSGetNormalizedPath then passes cwdLen-1, which 
may also not be correct.  The entire handling of the case for 
cwdLen == 0 may be incorrect in other places.  It is likely 
most prudent to revert this all until a more thorough review 
with additional tests is made.

hobbs added on 2003-02-11 09:08:58:

File Added - 42051: fs3-682500.diff

Logged In: YES 
user_id=72656

Attached is the patch with extra failing test.

hobbs added on 2003-02-11 04:31:07:
Logged In: YES 
user_id=72656

The current patch is incorrect.  This needs further testing.

vincentdarley added on 2003-02-10 19:58:52:
Logged In: YES 
user_id=32170

This patch has been applied.  Further improvements are 
definitely still possible, but require a bit more analysis 
first.

hobbs added on 2003-02-10 10:48:58:

File Added - 41965: fs2-682500.diff

Logged In: YES 
user_id=72656

Attached updated patch.

vincentdarley added on 2003-02-10 06:37:46:
Logged In: YES 
user_id=32170

Attached newer patch.  Should work on Linux, Windows 
at least.

vincentdarley added on 2003-02-10 06:36:24:

File Added - 41948: fsspeed2.patch

hobbs added on 2003-02-09 11:49:30:

File Added - 41889: fs-682500.diff

hobbs added on 2003-02-09 11:49:27:
Logged In: YES 
user_id=72656

This patch appears incorrect.  I've attached something that 
may be more correct, but there may be more fundamental 
flaws in the changes.

hobbs added on 2003-02-09 10:00:29:
Logged In: YES 
user_id=72656

Note that this part of the patch looks highly suspicious to me, 
although the return does seem key to Win not going boom:

@@ -3766,10 +3761,14 @@
     if (objPtr->typePtr == &tclFsPathType) {
 FsPath *fsPathPtr = (FsPath*) objPtr-
>internalRep.otherValuePtr;
 if (fsPathPtr->filesystemEpoch != 
theFilesystemEpoch) {
+    if (objPtr->bytes == NULL) {
+
+    }
     FreeFsPathInternalRep(objPtr);
     objPtr->typePtr = NULL;
     return Tcl_ConvertToType(interp, objPtr, 
&tclFsPathType);
 }
+return TCL_OK;
 if (fsPathPtr->cwdPtr == NULL) {
     return TCL_OK;
 } else {

That's in tclIOUtil.c.  Also, this patch blows the unix test 
suite (no crashes, just lots of errors), so something about it 
isn't correct.  I've isolated it to the tclUnixFile.c change.  That 
looks OK, but I had to revert to the old version for 
correctness.  Note that one simple change erases all 
speedups on Linux.

jcw added on 2003-02-08 05:01:25:
Logged In: YES 
user_id=1983

confirmed to work (quick test) on Win32 and Linux
- binary tclkits based on these now in http://www.equi4.com/pub/tk/newer/

vincentdarley added on 2003-02-08 02:06:17:

File Added - 41786: testfs.tcl

vincentdarley added on 2003-02-08 02:06:16:
Logged In: YES 
user_id=32170

Added test script

vincentdarley added on 2003-02-08 02:05:29:

File Added - 41785: fsspeed.diff

Attachments: