Overview
| Artifact ID: | 193d4f154ca9a0232fa8faf7f5c92f7cc1c44452b0be03c341056604825378f7 |
|---|---|
| Ticket: | eeab90542804319c07ed3775926ad9791cf859ca
file glob semantics - support efficient retrieval - reduce round trips |
| User & Date: | juliannoble2 on 2023-08-20 13:24:59 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-plain"
- comment changed to:
The file glob command semantics of returning a single list of results doesn't allow for gathering other information that should be available in a single call to the filesystem. For example - a search/audit program that walks the filesystem may reasonably need to gather both subdirectories and files for each node. Whilst glob lets you search for files and dirs at once - they are not distinguished in the results. It is also inefficient in that, at least on some filesystems - other information such as file size (and attributes) is available in the same API call that gathers the directory contents. This is particularly a concern on windows - where the interaction with the slow 'file glob'/'file attributes' etc calls and multiple required calls to glob because of current semantics make the slow-downs massive. (see ticket: https://core.tcl-lang.org/tcl/tktview/411f52ed87) The request is for an enhancement to file glob - something like -dict ?desired keys|all? that will return a dict containing at least the keys files & dirs & links and ideally a filesizes key where the value is the size of each file in the same order as returned by the list of names in files. That way the caller could process using: foreach fname [dict get $result files] fsize [dict get $result filesizes] ... Other file or directory attributes could have their own key for ordered results. If a particular platform can't gather the information - an empty list could be returned for that attribute list, requiring the caller to make repeated calls to gather it if required. The semantic shortcomings of glob become apparent when attempting to implement a pure tcl equivalent of the unix du command. Initial attempts gave results around 20x worse than execing out to du - but by using twapi on windows to reduce the number of required glob calls and file size calls - the performance acheivable was much better than an external tool for small and medium size trees, and even competitive or better on some larger systems. I know of no such optimisation on unix-like platforms - so presumably pure Tcl script remains uncompetitive with external tools and other languages for a class of filesystem-walking operations - when it doesn't need to be.
- foundin changed to: "Any"
- is_private changed to: "0"
- login: "juliannoble2"
- priority changed to: "5 Medium"
- private_contact changed to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "juliannoble2"
- subsystem changed to: "37. File System"
- title changed to:
file glob semantics - support efficient retrieval - reduce round trips
- type changed to: "RFE"