|
2026-10-15
| ||
| 11:39 | • Closed ticket [3e25ac512e]: file inconsistent handling of VFS/.. plus 4 ot... artifact: 0d135a2f8c user: serhiy.storchaka | |
|
2026-03-16
| ||
| 13:05 | • Open ticket [108904173c]: glob and file normalize inconsistencies on case insens... artifact: 72658b00bc user: sebres | |
|
2024-12-02
| ||
| 14:39 | • Ticket [02d5d65d70] File subsystem commands and operations suffer from unneeded ... artifact: 28ac18472e user: sebres | |
| 13:58 | • Ticket [02d5d65d70]: 4 changes artifact: bc5db7e692 user: dgp | |
| 13:35 | • Ticket [02d5d65d70]: 4 changes artifact: b9f42233d2 user: dgp | |
| 13:08 | • Ticket [02d5d65d70]: 4 changes artifact: 0a4cfc2ab3 user: dgp | |
| 13:00 | • Ticket [02d5d65d70]: 5 changes artifact: 955b82e15e user: dgp | |
|
2024-10-09
| ||
| 08:52 | • Closed ticket [411f52ed87]: file performance on windows is slow depending on pat... artifact: 1242ce4a4d user: sebres | |
|
2024-09-19
| ||
| 10:38 | Merge [88fef0563f33ac19]: Mem-leak fix for [02d5d65d70]. check-in: 70fb978287 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
| 10:24 | Merge [265dc4708a3bf925]: avoid unneeded (but expensive) path normalization for several file subsyst... check-in: 9f74f3299b user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-09-18
| ||
| 10:56 | • Closed ticket [02d5d65d70]: File subsystem commands and operations suffer from u... artifact: 58f41915dd user: sebres | |
| 10:54 | merge 8.7 (mem-leak fix for [02d5d65d70]) check-in: 88fef0563f user: sebres tags: trunk, main | |
| 10:53 | amend to [02d5d65d70]: fixed memory leak (using translated path) check-in: 536390e425 user: sebres tags: core-8-branch | |
| 10:40 | • Ticket [02d5d65d70] File subsystem commands and operations suffer from unneeded ... artifact: 8f319d82e9 user: sebres | |
| 09:52 | Attempt to fix build failure caused by fix [02d5d65d70] (8.7 and 9.0 only) closed check-in: 9e05dce8e9 user: jan.nijtmans tags: bug-02d5d65d70 | |
| 08:21 | • Open ticket [02d5d65d70]: File subsystem commands and operations suffer from unn... artifact: 2ca15e06cf user: jan.nijtmans | |
|
2024-09-17
| ||
| 15:58 | • Closed ticket [02d5d65d70]. artifact: 1c81e7de4b user: sebres | |
| 15:57 | • Ticket [02d5d65d70]: 3 changes artifact: 37358503a9 user: sebres | |
| 15:35 | merge 8.7: avoid unneeded (but expensive) path normalization for several file subsystem commands and... check-in: 265dc4708a user: sebres tags: trunk, main | |
| 15:17 | fixes further normalization bottleneck of 8.7+ [02d5d65d70adab97], guess [411f52ed87e313dd49e2] too ... check-in: ed87833280 user: sebres tags: core-8-branch | |
| 14:32 | merge 8.6 (fix attempt for [02d5d65d70adab97], however the small bottleneck is still visible) check-in: 86abe9aa4a user: sebres tags: core-8-branch | |
| 14:13 | merge bug-02d5d65d70adab97: avoid unneeded (but expensive) path normalization for several file subsy... check-in: a6a5870235 user: sebres tags: core-8-6-branch | |
|
2024-09-15
| ||
| 11:16 | • Ticket [02d5d65d70] File subsystem commands and operations suffer from unneeded ... artifact: 3755a4ea96 user: sebres | |
|
2024-09-14
| ||
| 21:33 | • Ticket [02d5d65d70]: 3 changes artifact: c97c2c202c user: jan.nijtmans | |
| 21:32 | • Ticket [02d5d65d70]: 3 changes artifact: 7607f37a3d user: jan.nijtmans | |
| 17:10 | • Ticket [02d5d65d70]: 4 changes artifact: 300c25b564 user: oehhar | |
| 17:10 | • Ticket [411f52ed87] file performance on windows is slow depending on path vs str... artifact: 0107826fce user: oehhar | |
| 09:47 | • Ticket [02d5d65d70] File subsystem commands and operations suffer from unneeded ... artifact: 55f164ae24 user: sebres | |
| 01:05 | • Ticket [02d5d65d70]: 3 changes artifact: 4a824c4250 user: juliannoble2 | |
|
2024-09-13
| ||
| 21:39 | • Ticket [02d5d65d70]: 3 changes artifact: 4155e6330d user: sebres | |
| 18:46 | • Ticket [02d5d65d70]: 3 changes artifact: f9ad82f0fb user: dgp | |
| 13:25 | • Pending ticket [02d5d65d70]. artifact: 100654cbe0 user: sebres | |
| 12:07 | because the normalization is very expensive (see [02d5d65d70adab97]), don't invoke it for native or ... check-in: 70020277fb user: sebres tags: bug-02d5d65d70adab97 | |
| 12:02 | even if cwd is non native, but path is not relative we can safely use translated path instead of nor... check-in: 60aa1ebd2a user: sebres tags: bug-02d5d65d70adab97 | |
| 11:51 | added performance regression tests illustrating [02d5d65d70adab97] check-in: a2304eee9b user: sebres tags: bug-02d5d65d70adab97 | |
| 11:36 | • Ticket [02d5d65d70] File subsystem commands and operations suffer from unneeded ... artifact: b43c183594 user: sebres | |
| 11:35 | • New ticket [02d5d65d70]. artifact: 90c938ccf2 user: sebres | |
File subsystem commands and operations suffer from unneeded (but expensive) path normalization
This is almost invisible if one is testing with constant path (literals), because they hold then normalized path in internal representation, but very well bothering on variable path objects, what is mostly the normal case, if paths gets generated, read from somewhere, anyway dynamically constructed every time before their usage.
But the path normalization is very expensive, especially it is noticeable on hosts with rude corporate "protection" software like AV/DLP/Endpoint-Protection/Whatever-else-bothers-dev-to-work.
Just note that particularly by windows the function TclpObjNormalizePath doing GetFileAttributesExW + WinReadLinkDirectory + FindFirstFileW (basically glob)!
Below are 2 examples illustrating this behaviour on such a host. Note that _determ_fn always creates new object, and string trim is used only to force this, as well as the costs of such path generation is almost to neglect (0.01%), additionally the T:-drive used here is a RAM-disk:
% proc _determ_fn {i} { string trimright "T:/TestCLU/a7/40vbp43/vu/3g/616q4bet2lf53lf88vo5q2.ent " }
% timerate { set fn [_determ_fn 123] }; # costs of deterministic path generation
0.457163 µs/# 2081613 # 2187404 #/sec 951.636 net-ms
% set fn [_determ_fn 123]; timerate { close [open $fn] }; # 1 time normalization
1411.53 µs/# 709 # 708.45 #/sec 1000.774 net-ms
% timerate { set fn [_determ_fn 123]; close [open $fn] }; # every time normalization
3060.91 µs/# 327 # 326.70 #/sec 1000.917 net-ms
The cost of such (unneeded here!) normalization overhead - 1650 µs, so more than 50%.
The same is valid for another, much faster file commands like file exists, file attributes, file stat etc. However there the overhead may be up to 95% under normal circumstances or up to 1000% on hosts with rude corporate infrastructure or for UNC-paths over network (samba, cifs, nfs, etc):
% set fn [_determ_fn 123]; timerate { file exists $fn }; # 1 time normalization
4.277398 µs/# 116259 # 233786 #/sec 497.286 net-ms
% timerate { set fn [_determ_fn 123]; file exists $fn }; # every time normalization
1505.03 µs/# 665 # 664.44 #/sec 1000.845 net-ms
I would like to emphasise once again - the constant literal paths is rather an exception, because the normal case is usually a dynamic path object that is created or read from somewhere instantly before its usage: corresponds the second (red) case in both illustrations above.
I already fixed this and will try to provide a solution soon together with performance regression-test coverage.
0d135a2f8cClosed ticket [3e25ac512e]: [file] inconsistent handling of VFS/.. plus 4 other changes ticket2026-10-15 11:39:5172658b00bcOpen ticket [108904173c]: glob and file normalize inconsistencies on case insensitive filesystem plus 5 other changes ticket2026-03-16 13:05:5970fb978287Merge [88fef0563f33ac19]: Mem-leak fix for [02d5d65d70]. check-in2024-09-19 10:38:4688fef0563fmerge 8.7 (mem-leak fix for [02d5d65d70]) check-in2024-09-18 10:54:54536390e425amend to [02d5d65d70]: fixed memory leak (using translated path) check-in2024-09-18 10:53:499e05dce8e9Attempt to fix build failure caused by fix [02d5d65d70] (8.7 and 9.0 only) check-in2024-09-18 09:52:26
Fixed in branch bug-02d5d65d70adab97 for 8.6. All tests pass (win/unix), there is almost no overhead visible anymore in performance regressions tests.
I'll merge it later if no objections follow.
If someone can get to it before I can, please check this revision doesn't cause troubles with trofs. https://math.nist.gov/~DPorter/tcltk/trofs/
Why should it, Don?
I hope the fix affects only absolute paths (in native FS) or relative paths if cwd is native, otherwise I guess tcl should already have caused troubles previously too.
One case may be surely a bit incompatible or unexpected behaviour of functions in VFS-definition (e. g. filesystemPathTypeProc or pathInFilesystemProc), but then they can be adjusted to consider "new" handling.
However it is surely worth to check the branch against few VFS.
This issue has bugged me for a long time. I assume we could close this too now as I think it's essentially the same problem? https://core.tcl-lang.org/tcl/tktview/411f52ed87e313dd49e2
Indeed, [411f52ed87e313dd49e2] looks very similar. However I'd like to see what would happen with 9.0 once this branch gets merged, since it seems to have a bit different timing (suspecting something around tilde-expansion changes).
Sergey, great work !
Julian refers to ticket [411f52ed87e313dd49e2].
At least the Github ACTIONS build doesn't show any errors.
Since 8.6.15 is close to release, I suggest to wait until after this release for the merge. After that: no objection from me.
Hm. Better point to the Github ACTIONS build on Windows. They pass too.
Just a note for me: the check for tilde expansion (marked with TODO in the branch) is indeed not really necessary for 9.0, because file pathtype ~/test is "relative" since merge of TIP#602, where still "absolute" for 8.x.
However, it'd be better to have a common function that'll be able to tell whether normalization is needed. Or maybe to move some logic into VFS-definition for Tcl_FSGetNativePath (where it basically belongs to).
8.6.15 is released, thus the fix is merged now in all branches >= 8.6.
For 8.7+ there was additional unneeded normalization in zipfs, which is solved in [ed87833280], and merged as whole thing in 9.0 in [265dc4708a3bf925] + small amend hereafter (removing tilde expansion check for windows).
I hope the major issues of [411f52ed87e313dd49e2] are fixed too now (at least the performance regression of 8.7+).
However there was also mentioned a glob command (which is notoriously slow under windows)... I don't think there is good a way to speed-up it together with file normalize, excepting possibly a new option like file normalize -fast ... what could do normalization similar translated path + sym-links, but without FindFirstFileW and co (so no unique path generation).
All --enable-symbols=mem builds for 8.7 and 9.0 are failing now on all platforms. There appears to be a memory leak. Therefore, re-opening.
@sebres, can you have a look at this? I suspect the changes in the zipfs, since 8.6 doesn't have that part, and the leak is visible on all platforms not only Windows.
Hmm... Indeed. It is because Tcl_FSGetTranslatedPath in opposite to Tcl_FSGetNormalizedPath always returns an incremented object reference (why basically? like normPathPtr, translatedCwdPtr is also stored in the internal representation and it'd be no needs to increase it at all). Anyway will fix it asap.
By the way, I noticed your comment only accidental - because there are no mails from tcl-repo in the mailing list anymore since 27th Aug (the mails [Tk] arriving, but not [Tcl])... And it is surely not my system, because in SF mailing list archive also nothing since 27th Aug.
Mem-leak is fixed in [536390e4258fbef0], thus close.
The memory leak fix needs to be backported to the 8.6 branch, right? I see leaks in the 8.6.16 release candidate.
No. That memleak fix is in zipfs code, which isn't in Tcl 8.6. This major system rewrite in a patch release of a stable branch has instead introduced some other memleaks. Searching....
The commit [a6a5870235ce08b2] modifies the routine
TclFSCwdIsNative(), adding a call to Tcl_FSGetCwd().
That call (eventually) allocates a Tcl_Obj in line 735:
tsdPtr->cwdPathPtr = Tcl_NewStringObj(str, len);
and that allocation leaks.
Not yet clear to me why the existing refcount housekeeping
isn't able to handle this.
Maybe this is easy. Documentation for Tcl_FSGetCwd() says
"...The result already has its reference count incremented for the caller.
When it is no longer needed, that reference count should be decre‐
mented."
This new call doesn't seem to be following the instructions. Will try
that as a fix.
Good catch, Don!..
I added small amend [e4feb601a833fa18] to avoid possible theoretical segfault.
However it'd be nice to have some routine updating cwdPath (tsdPtr->cwdPathPtr) and epoch without to return incremented reference (so one could use it instead of Tcl_FSGetCwd for the init purposes).