On Mar 5, 2009, at 9:09 AM, Josh Graessley wrote: One little wrinkle to remember while you're working on writing great code, network filesystem make all filesystem APIs as dangerous to call synchronously as network calls. It's a shame there aren't better asynchronous filesystem APIs.
I heartily agree. I spent yesterday working at home, and due to my employer's strict policy against putting source code on laptops, I had to access my files via NFS over VPN over DSL. So the latency of any filesystem call, even a stat, was about 0.1 to 0.3 seconds.
This did not make working with IDEs fun. Both TextMate and Xcode like to stat every single file in every open project, whenever the app becomes active. This made working with my normal 5,000-file projects impossible (I had to kill TextMate after it had been spinning for several minutes), and even using small projects with a dozen files caused the app to spin for several seconds every time I switched to it. Yuck.
Last time I looked, I couldn't find any useable async filesystem APIs. Nonblocking I/O doesn't work on regular files, only sockets. (Actually I can't remember what happens if you use NSURLConnection on file: URLs ... does it always block?)
—Jens |