Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-20
02:38 • Ticket [219120ffff] Performance of glob command status still Closed with 3 o... artifact: 541e426de7 user: dgp
02:38 • Ticket [219120ffff]: 3 changes artifact: d25fb8c5c3 user: dgp
2000-10-26
08:34 • Closed ticket [219120ffff]. artifact: b57cefe6b5 user: welch
01:11 • New ticket [219120ffff]. artifact: b3bbc2ee9b user: nobody

Performance of glob command

Closed / Fixed219120ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:11:04
OriginalBugID: 6216 Bug
Version: 8.3.1
SubmitDate: '2000-09-05'
LastModified: '2000-10-20'
Severity: SER
Status: Released
Submitter: techsupp
ChangedBy: hobbs
OS: Windows 95
OSVersion: win95sr2
FixedDate: '2000-10-20'
FixedInVersion: 8.4a2
ClosedDate: '2000-10-25'


Name:
Martin Mergel

ReproducibleScript:
On a directory with 4000 files, a simple glob * takes about 2:45 minutes with Tcl 8.3.1

DesiredBehavior:
With Tcl 8.0.2, the same command is executed within 6 seconds



The file was stat'ed more than necessary.  This has been corrected

for 8.4a2 with the following patch:



Index: win/tclWinFile.c

===================================================================

RCS file: /home/cvs/external/tcl/win/tclWinFile.c,v

retrieving revision 1.7

diff -r1.7 tclWinFile.c

329,330c329,336

<       attr = (*tclWinProcs->getFileAttributesProc)(nativeName);

<       Tcl_DStringFree(&ds);

---

> 

>       /*

>        * 'attr' represents the attributes of the file, but we only

>        * want to retrieve this info if it is absolutely necessary

>        * because it is an expensive call.

>        */

> 

>       attr = NULL;

335a342

>                   attr = (*tclWinProcs->getFileAttributesProc)(nativeName);

392,396c399,406

<       } else if (attr & FILE_ATTRIBUTE_DIRECTORY) {

<           Tcl_DStringAppend(dirPtr, "/", 1);

<           result = TclDoGlob(interp, separators, dirPtr, tail, types);

<           if (result != TCL_OK) {

<               break;

---

>       } else {

>           attr = (*tclWinProcs->getFileAttributesProc)(nativeName);

>           if (attr & FILE_ATTRIBUTE_DIRECTORY) {

>               Tcl_DStringAppend(dirPtr, "/", 1);

>               result = TclDoGlob(interp, separators, dirPtr, tail, types);

>               if (result != TCL_OK) {

>                   break;

>               }

398a409,414

>       /*

>        * Free ds here to ensure that nativeName is valid above.

>        */

> 

>       Tcl_DStringFree(&ds);

> 

 

-- 10/20/2000 hobbs
welch Closed ticket [219120ffff]. [History diff]2000-10-26 08:34:57
dgp Ticket [219120ffff]: 3 changes [History diff]2001-04-20 02:38:11
dgp Ticket [219120ffff]: 3 changes [History diff]2001-04-20 02:38:24
Log in (anonymous is fine) to add a comment.