vocabs.hierarchy: much faster using directory entries.

John Benediktsson 2012-08-13 11:12:15 -07:00
parent 3c046fe12a
commit eea3ccbcfd
1 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007, 2009 Slava Pestov. ! Copyright (C) 2007, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs combinators.short-circuit fry USING: accessors arrays assocs combinators.short-circuit fry
io.directories io.files io.files.info io.pathnames kernel make io.directories io.files io.files.types io.pathnames kernel make
memoize namespaces sequences sorting splitting vocabs sets memoize namespaces sequences sorting splitting vocabs sets
vocabs.loader vocabs.metadata vocabs.errors ; vocabs.loader vocabs.metadata vocabs.errors ;
RENAME: child-vocabs vocabs => vocabs:child-vocabs RENAME: child-vocabs vocabs => vocabs:child-vocabs
@ -18,9 +18,12 @@ M: vocab-prefix vocab-name name>> ;
: vocab-subdirs ( dir -- dirs ) : vocab-subdirs ( dir -- dirs )
[ [
[ [
{ [ link-info directory? ] [ "." head? not ] } 1&& {
] filter [ type>> +directory+ = ]
] with-directory-files natural-sort ; [ name>> "." head? not ]
} 1&&
] filter [ name>> ] map!
] with-directory-entries natural-sort ;
: vocab-dir? ( root name -- ? ) : vocab-dir? ( root name -- ? )
over over