<commit_before>! Copyright (C) 2004, 2008 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors init namespaces words io
kernel.private math memory continuations kernel io.files
io.backend system parser vocabs sequences prettyprint
vocabs.loader combinators splitting source-files strings
definitions assocs compiler.errors compiler.units
math.parser generic sets debugger command-line ;
IN: bootstrap.stage2

SYMBOL: core-bootstrap-time

SYMBOL: bootstrap-time

: default-image-name ( -- string )
    vm file-name os windows? [ "." split1 drop ] when
    ".image" append resource-path ;

: do-crossref ( -- )
    "Cross-referencing..." print flush
    H{ } clone crossref set-global
    xref-words
    xref-generics
    xref-sources ;

: load-components ( -- )
    "include" "exclude"
    [ get-global " " split harvest ] bi@
    diff
    [ "bootstrap." prepend require ] each ;

: count-words ( pred -- )
    all-words swap count number>string write ;

: print-report ( -- )
    core-bootstrap-time get
    1000 /i
    60 /mod swap
    "Core bootstrap completed in " write number>string write
    " minutes and " write number>string write " seconds." print

    bootstrap-time get
    1000 /i
    60 /mod swap
    "Bootstrap completed in " write number>string write
    " minutes and " write number>string write " seconds." print

    [ compiled>> ] count-words " compiled words" print
    [ symbol? ] count-words " symbol words" print
    [ ] count-words " words total" print

    "Bootstrapping is complete." print
    "Now, you can run Factor:" print
    vm write " -i=" write "output-image" get print flush ;

[
    ! We time bootstrap
    millis<commit_msg>bootstrap.stage2: Factor out 'print-time'<commit_after>! Copyright (C) 2004, 2008 <NAME>.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors init namespaces words io
kernel.private math memory continuations kernel io.files
io.backend system parser vocabs sequences prettyprint
vocabs.loader combinators splitting source-files strings
definitions assocs compiler.errors compiler.units
math.parser generic sets debugger command-line ;
IN: bootstrap.stage2

SYMBOL: core-bootstrap-time

SYMBOL: bootstrap-time

: default-image-name ( -- string )
    vm file-name os windows? [ "." split1 drop ] when
    ".image" append resource-path ;

: do-crossref ( -- )
    "Cross-referencing..." print flush
    H{ } clone crossref set-global
    xref-words
    xref-generics
    xref-sources ;

: load-components ( -- )
    "include" "exclude"
    [ get-global " " split harvest ] bi@
    diff
    [ "bootstrap." prepend require ] each ;

: count-words ( pred -- )
    all-words swap count number>string write ;

: print-time ( time -- )
    1000 /i
    60 /mod swap
    number>string write
    " minutes and " write number>string write " seconds." print ;

: print-report ( -- )
    "Core bootstrap completed in " write core-bootstrap-time get print-time
    "Bootstrap completed in "      write bootstrap-time      get print-time

    [ compiled>> ] count-words " compiled words" print
    [ symbol? ] count-words " symbol words" print
    [ ] count-words " words total" print

    "Bootstrapping is complete." print
    "Now, you can run Factor:" print
    vm write " -i=" write "output-image" get print flush ;

[
    ! We time bootstrap
    millis
{'fraction_non_alphanumeric': 0.10345855694692904, 'fraction_numerical': 0.011627906976744186, 'mean_word_length': 3.003579952267303, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4201193', 'n_tokens_mistral': 1009, 'n_tokens_neox': 956, 'n_words': 330}