open
https://gitlab.synchro.net/main/sbbs/-/work_items/1359
## Summary
When a List Files loadable module is configured (SCFG->System->Loadable Modules->List Files, e.g. the stock `listfiles` module from #1353), a new-file scan starts the module for every directory scanned, including the (usually many) directories with no new files. The built-in lister skips those with a fast index check; the module can't, because it is started before that check.
## Where
In `listfiles()` (`src/sbbs3/listfile.cpp`), the module is invoked first:
i = exec_mod("list files", cfg.listfiles_mod, &invoked, "%s %u %s", cfg.dir[dirnum]->code, mode, filespec);
if (invoked)
return i;
and only after that does the built-in path do the new-file check:
if (mode & FL_ULTIME) {
last_ns_time = now;
if (!newfiles(&smb, ns_time)) // this is fast
return 0;
## Cost
Starting the JavaScript module (loading the script and its libraries) costs roughly 25 ms per directory, measured with jsexec on one host. A new-file scan of 500 directories with few new files therefore takes about 12 seconds longer with the module than with the built-in lister, for no visible output.
## Proposal
For `FL_ULTIME` (new-file scans), do the `smb_init_dir()` + `newfiles()` check, and set `last_ns_time`, before calling `exec_mod()`, returning 0 without invoking the module when the directory has no new files. Other modes are unchanged. A module that is invoked still sees the same arguments and still finds the new files itself; it just isn't started for directories that would display nothing.
- *Authored by Claude (Claude Code), on behalf of @rswindell*
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)