links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 2:07 pm UTC on 16 January 2006


Obsolete - UnixDirectoryPlugin has been replaced by DirectoryPlugin.

Download UnixFileDirectoryV1-2-dtl.cs.gz (26-Jan-2002)

UnixFileDirectoryPlugin provides a significant improvement in directory access speed on platforms with Posix style directory streams. It provides primitives for access to opendir(), readdir() and related calls, as well as stat() calls on named files. This enables performance improvements for methods such as FileDirectory>>entries, FileDirectory>>fileAndDirectoryNames, FileDirectory>>isAFileNamed, FileDirectory>>fileExists, UnixFileDirectory>>entryAt:, and similar methods.

On my system:
FileDirectory>>directoryContentsFor: 7.8X improvement
FileDirectory>>entryAt:ifAbsent: 32X improvement
StandardFileStream>>isAFileNamed: 1800X improvement

Primitive access methods are provided on the class side of UnixFileDirectoryPlugin in order to prevent pollution of the current FileDirectory and FileStream hierarchies. Hooks are put into UnixFileDirectory and StandardFileStream to make use of the plugin with the fewest possible changes to these classes.

Performance test methods are also provided on the class side of the plugin to profile the code and demonstrate the performance differences.

To do:
1) Need to protect against process switching in the middle of a UnixDirectory>>entries method. The plugin currently used a static variable pointing at its directory stream. This is a poor design (although it seems to work fine in practice for me).
2) Do proper integration into the base image, preferably in conjunction with adding Flow to Squeak.
3) Write SUnit tests to verify correct operation under all the permutations of read/write/execute permissions on files and directories I've already squashed some ugly bugs here, and need to test to make sure I've gotten them all.
4) The semantics of #isAFileNamed: are changed. This plugin checks to see if the file exists, while the base image checks to see if it exists and can be opened. Either need to change to exactly match prior semantics, or test to verify that the change does not break existing applications.

The plugin was built entirely within Squeak using VMMaker, OSProcess, and CommandShell.

Current version:
UnixFileDirectoryV1-2-dtl.cs.gz (26-Jan-2002)
adds bug fixes, hooks into the Squeak base classes, performance tests and profiling

Old versions:
UnixFileDirectoryV1-0-dtl.cs.gz (13-Jan-2002) original post
UnixFiledirectoryV1-1-dtl.cs.gz (19-Jan-2002) adds fast file stat methods