Menu

#1186 Performance of glob command

obsolete: 8.3.1
closed-fixed
nobody
2
2001-04-19
2000-10-26
Anonymous
No

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

Discussion

  • Brent B. Welch

    Brent B. Welch - 2000-10-26
    • priority: 5 --> 2
    • status: open --> closed-fixed
     
  • Don Porter

    Don Porter - 2001-04-19
    • labels: 104246 --> 104242
     
  • Don Porter

    Don Porter - 2001-04-19
    • labels: 104242 --> 36. Pathname Management
     
MongoDB Logo MongoDB