ioFTPD already caches directory size & permissions (has done this since beta4) Managment of cache is LALR - last accessed, last released
Cache is global, and updated once directory modification has been noticed. Contents of directory however are not cached (caching them is rather stupid, as OS already caches them)
I did some testing just for you:
200 PORT command successful.
150 Opening BINARY mode data connection for directory listing.
721
ftp: 3014025 bytes received in 0,08Seconds 37675,31Kbytes/sec.
ftp> dir "*/*/*/*" d:\whew
debian:/work# cat whew | wc -l
36560
721milliseconds, ~0.7secs to build list of 3mbytes (nearly 37k entries) This includes time includes buffer formatting, reading + checking directory/file permissions [possible private paths] & grabbing directory sizes from cache, mounts (this count does not include subdirectories/files that were not shown)
I really can't see room for improvements there