https://gitlab.synchro.net/main/sbbs/-/commit/fd1fc7dfe3a4399bb9007cf8
Modified Files:
src/sbbs3/filedat.c filedat.h js_filebase.cpp
Log Message:
Read a file directory once to list it, not each file's size and date
For a directory with file existence checking enabled (the default), FileBase.get_list() looked up each file's current size and date one file
at a time: a case-correcting existence check, then a stat for the size and another for the date. Where the file area is reached over SMB that is
three network round trips per file. On a Windows host serving a
3,607-file directory from a Samba share, get_list() took 30 to 46 seconds,
and its web listings (the /files/ index and the webv4 Files page) about a minute.
The new getfilestats() reads the storage directory once and fills in each listed file's size and date, which getfilesize() and getfiletime() then
return without touching the disk. On Windows, _findfirst64() returns every entry's size and date with the directory listing itself; xpdev's
opendir() can't be used, as its dirent carries only a name. Elsewhere, opendir() supplies the names and each matching file is stat()ed once.
A name matches exactly or, failing that, ignoring case, as fexistcase()
does. Files not found, and empty files, are left to the existing per-file checks. get_list() uses it for listings of 32 or more files.
On that Windows host, get_list() for the 3,607-file directory now takes
0.8 seconds, the /files/ index 3.9 seconds (was 59), and the webv4 Files
page 12 seconds (was 44). On Linux, sizes and dates are unchanged for all 86,449 listed files in 609 directories, except that a file whose stored
name differs in case from the name on disk now gets its date: the old
path corrected the case for the size check but not for the date check,
and reported -1.
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net