Thanks Nicolas. I would appreciate any effort in this directory since I
also have a 10gb package-cache and yes, I know it is slow.
If you can provive a slice :)

On Thu, May 10, 2012 at 9:44 AM, Stéphane Ducasse <[email protected]
> wrote:

> :)
>
> indeed. Imagine my 10 GB package cache.
>
> Stef
>
>
> On May 10, 2012, at 12:18 AM, Nicolas Cellier wrote:
>
> > The efficiency of FileList>>listForPattern: is something which should
> > deserve a bit more care.
> >
> > It tries to sort the files, for example by name, but wants to display
> > directory first
> >       ^ [ :x :y | |xIsDir|
> >                       ((xIsDir := x isDirectory) = y isDirectory)
> >                               ifTrue: [   x basename <= y basename  ]
> >                               ifFalse: [
> >                                       "directories always precede files"
> >                                       xIsDir ]]
> >
> > Alas, this isDirectory test cost you an arm:
> >
> > FileReference>>isDirectory
> >       ^ filesystem isDirectory: path
> >
> > FileSystem>>isDirectory: aResolvable
> >       "Resolve the argument, and answer true if the result refers
> >       to a directory, false if it refers to a file or doesn't exist."
> >
> >       ^ store isDirectory: (self resolve: aResolvable)
> >
> > FileSystemStore>>isDirectory: aPath
> >       aPath isRoot ifTrue: [ ^ true ].
> >       self
> >               nodeAt: aPath
> >               ifPresent: [ :entry | ^ self basicIsDirectory: entry ]
> >               ifAbsent: [ ^ false ].
> >
> > DiskStore>>nodeAt: aPath ifPresent: presentBlock ifAbsent: absentBlock
> >       | name|
> >       aPath isRoot ifTrue: [ ^ presentBlock value: self rootNode ].
> >       "| encodedPath encodedBasename entry |
> >       encodedPath := Primitives encode: (self stringFromPath: aPath
> parent).
> >       encodedBasename := Primitives encode: aPath basename.
> >       entry := Primitives lookupDirectory: encodedPath filename:
> encodedBasename.
> >       ^ entry == #badDirectoryPath
> >               ifTrue: absentBlock
> >               ifFalse: [
> >                       entry at: 1 put: aPath basename.
> >                       presentBlock value: entry ]."
> >       name := aPath basename.
> >       self
> >               directoryAt: aPath parent
> >               ifAbsent: absentBlock
> >               nodesDo:
> >                       [ :entry |
> >                       (self filename: (entry at: 1) matches: name)
> >                               ifTrue: [ ^ presentBlock value: entry ] ].
> >       ^ absentBlock value
> >
> > Arghh, it scans the whole parent directory again!
> > If sort is O(n log n), then we transform it into O(2 n^2 log n).
> >
> > Try to browse your package-cache if you're not a chicken.
> > Seriously, it's unusable...
> >
> > Nicolas
> >
>
>
>


-- 
Mariano
http://marianopeck.wordpress.com

Reply via email to