Clean up tools.vocabs a bit
							parent
							
								
									b891555472
								
							
						
					
					
						commit
						f341b2a02c
					
				| 
						 | 
				
			
			@ -2,27 +2,27 @@
 | 
			
		|||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: kernel vocabs vocabs.loader tools.time tools.vocabs
 | 
			
		||||
arrays assocs io.styles io help.markup prettyprint sequences
 | 
			
		||||
continuations debugger ;
 | 
			
		||||
continuations debugger combinators.cleave ;
 | 
			
		||||
IN: benchmark
 | 
			
		||||
 | 
			
		||||
: run-benchmark ( vocab -- result )
 | 
			
		||||
  [ dup require [ run ] benchmark ] [ error. drop f f ] recover 2array ;
 | 
			
		||||
  [ [ require ] [ [ run ] benchmark nip ] bi ] curry
 | 
			
		||||
  [ error. f ] recover ;
 | 
			
		||||
 | 
			
		||||
: run-benchmarks ( -- assoc )
 | 
			
		||||
  "benchmark" all-child-vocabs values concat [ vocab-name ] map
 | 
			
		||||
  "benchmark" all-child-vocabs-seq
 | 
			
		||||
  [ dup run-benchmark ] { } map>assoc ;
 | 
			
		||||
 | 
			
		||||
: benchmarks. ( assoc -- )
 | 
			
		||||
    standard-table-style [
 | 
			
		||||
        [
 | 
			
		||||
            [ "Benchmark" write ] with-cell
 | 
			
		||||
            [ "Run time (ms)" write ] with-cell
 | 
			
		||||
            [ "GC time (ms)" write ] with-cell
 | 
			
		||||
            [ "Time (ms)" write ] with-cell
 | 
			
		||||
        ] with-row
 | 
			
		||||
        [
 | 
			
		||||
            [
 | 
			
		||||
                swap [ dup ($vocab-link) ] with-cell
 | 
			
		||||
                first2 pprint-cell pprint-cell
 | 
			
		||||
                [ [ 1array $vocab-link ] with-cell ]
 | 
			
		||||
                [ pprint-cell ] bi*
 | 
			
		||||
            ] with-row
 | 
			
		||||
        ] assoc-each
 | 
			
		||||
    ] tabular-output ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,8 +13,7 @@ M: no-edit-hook summary
 | 
			
		|||
SYMBOL: edit-hook
 | 
			
		||||
 | 
			
		||||
: available-editors ( -- seq )
 | 
			
		||||
    "editors" all-child-vocabs
 | 
			
		||||
    values concat [ vocab-name ] map ;
 | 
			
		||||
    "editors" all-child-vocabs-seq [ vocab-name ] map ;
 | 
			
		||||
 | 
			
		||||
: editor-restarts ( -- alist )
 | 
			
		||||
    available-editors
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,11 +210,11 @@ MEMO: all-vocabs-seq ( -- seq )
 | 
			
		|||
    ] { } map>assoc
 | 
			
		||||
    f rot unrooted-child-vocabs 2array add ;
 | 
			
		||||
 | 
			
		||||
: load-children ( prefix -- )
 | 
			
		||||
    all-child-vocabs values concat
 | 
			
		||||
    filter-dangerous
 | 
			
		||||
    require-all
 | 
			
		||||
    load-failures. ;
 | 
			
		||||
: all-child-vocabs-seq ( prefix -- assoc )
 | 
			
		||||
    vocab-roots get swap [
 | 
			
		||||
        dupd (all-child-vocabs)
 | 
			
		||||
        [ vocab-dir? ] with subset
 | 
			
		||||
    ] curry map concat ;
 | 
			
		||||
 | 
			
		||||
: map>set ( seq quot -- )
 | 
			
		||||
    map concat prune natural-sort ; inline
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue