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

DirectoryPlugin version 1.5 (6-Aug-2003)

Contributed by Dave Lewis

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.