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 4:41 pm UTC on 8 November 2015


Contributed by Dave Lewis

November 2015: The latest versions of DirectoryPlugin and DirectoryPluginAccess are maintained at http://www.squeaksource.com in project DirectoryPlugin.

DirectoryPlugin provides access to a Posix directory stream for efficient access to directory contents. It also provides methods for testing file status and how to creating directory entries for a files and directories.

The directory stream primitives use the address of a directory stream as a handle to identify a directory stream. This permits several directory streams to be opened and manipulated independently by separate Smalltalk processes. However, care must be taken to avoid passing the handle for an invalid directory stream (such as one which has already been closed) to one of these methods.

The plugin has been tested on Linux and on Windows. The directory stream support produces a performance improvement only on Unix (Linux) systems. The file access primitives provide substantial improvements for both Unix and Windows systems. Other platforms have not been tested.

DirectoryPluginAccess provides access to primitives in DirectoryPlugin, along with utility methods for various directory and file access functions.

DirectoryPlugin version 1.5 (6-Aug-2003)

Download current version DirectoryPluginV1-5-dtl.sar for Squeak 3.6

Version 1.5 replaces 1.4 (4-Aug-2003), and adds stub methods to the plugin to prevent warning messages from the VM (for initialiseModule and shutdownModule).

Previous released version was 1.3 http://swiki.gsug.org:8080/sqfixes/2185.html (13 Feb 2002)

Replaces UnixDirectoryPlugin

DirectoryPlugin runs on Unix and Windows, and provides a noticable improvement in many directory and file access methods. If you use CommandShell on Unix (Linux), you should see an overall 15X improvement based on timing the CommandShell SUnit tests with and without DirectoryPlugin.

Formerly called UnixFileDirectory, this version is rewritten to permit multiple file streams to be manipulated by different Smalltalk processes. It is renamed to reflect cross platform support, currently Unix and Windows. Other platforms have not been tested.

DirectoryPlugin provides access to file stat calls, which provides significant improvement to methods such as FileDirectory>>isAFileNamed, FileDirectory>>fileExists, UnixFileDirectory>>entryAt:, and similar methods.

DirectoryPlugin 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. On Unix systems, this enables performance improvements for methods such asFileDirectory>>entries and FileDirectory>>fileAndDirectoryNames. The primitives run on Windows also, but do not improve performance.

This change set hooks the directory stream primitives into UnixFileDirectory so they are in effect only for Unix systems. It hooks the file stat primitives into StandardFileStream and FileDirectory, so they provide performance improvements for both Windows and Unix systems.

Performance improvement on my system, running Linux:

Performance improvement on my system, running Windows:

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. Do proper integration into the base image, preferably in conjunction with adding Flow to Squeak.
  2. 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.
  3. The semantics of #isAFileNamed: are slightly changed. Need to test to verify that the change does not break existing applications.
  4. Test DirectoryPlugin with SecurityPlugin. Make sure the security functions in DirectoryPlugin work, and find out how much performance degradation accurs with security turned on.