faster startup 7/n

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

faster startup 7/n

Paolo Bonzini
VFS was a hog not only when quitting, but also on startup.  This simple
patch brings hello-world time down to 58ms (without copy-on-write) and
42ms (with).

Of these, about 8ms are spent in the last remaining call to
allSubinstancesDo: (in FileDescriptor), but I don't see an easy way to
remove it or to make it faster.  The remaining 50ms/34ms are the sheer
startup time.

Paolo

--- orig/kernel/VFS.st
+++ mod/kernel/VFS.st
@@ -228,10 +228,7 @@ update: aspect
      filesystems specified by the subclasses upon image load."
 
     (aspect == #returnFromSnapshot or: [ aspect == #finishedSnapshot ]) ifTrue: [
- Registry := LookupTable new.
- self allSubclassesDo: [ :each |
-    each fileSystems do: [ :fs | self register: fs forClass: each ]
- ]
+ Registry := nil.
     ].
     (aspect == #aboutToQuit or: [ aspect == #aboutToSnapshot ]) ifTrue: [
  self allSubclassesDo: [ :each | each release ].
@@ -262,6 +259,10 @@ vfsFor: fileName name: fsName subPath: s
     "Create an instance of a subclass of the receiver, implementing the virtual
      file `subPath' inside the `fileName' archive.  fsName is the virtual
      filesystem name and is used to determine the subclass to be instantiated."
+    Registry isNil ifTrue: [
+ Registry := LookupTable new.
+ self allSubclassesDo: [ :each |
+    each fileSystems do: [ :fs | self register: fs forClass: each ] ] ].
     ^(Registry at: fsName)
  vfsFor: fileName name: fsName subPath: subPath!
 

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk