raco make: improve parallelism
The `require` macro now logs "prefetch" messages when it sees a `require`
with multiple module paths. The prefix information is approximate, since
parsing a `require` subform might depend on imports from a previous subform,
but in the common case, there are many obvious module paths to prefetch.
The parallel mode of `raco make` watches for prefetch messages and
records the suggested "prefetch" paths so they can be compiled by other
processes.
original commit: 9e3b984463
This commit is contained in:
parent
633ec1faf5
commit
03a0dbd9fd
|
@ -5,6 +5,7 @@
|
||||||
compiler/compiler
|
compiler/compiler
|
||||||
dynext/file
|
dynext/file
|
||||||
setup/parallel-build
|
setup/parallel-build
|
||||||
|
setup/path-to-relative
|
||||||
racket/match)
|
racket/match)
|
||||||
|
|
||||||
(module test racket/base)
|
(module test racket/base)
|
||||||
|
@ -98,14 +99,18 @@
|
||||||
dest)))))))]
|
dest)))))))]
|
||||||
;; Parallel make:
|
;; Parallel make:
|
||||||
[else
|
[else
|
||||||
|
(define path-cache (make-hash))
|
||||||
(or (parallel-compile-files
|
(or (parallel-compile-files
|
||||||
source-files
|
source-files
|
||||||
#:worker-count (worker-count)
|
#:worker-count (worker-count)
|
||||||
#:handler (lambda (type work msg out err)
|
#:handler (lambda (id type work msg out err)
|
||||||
|
(define (->rel p)
|
||||||
|
(path->relative-string/library p #:cache path-cache))
|
||||||
(match type
|
(match type
|
||||||
['done (when (verbose) (printf " Made ~a\n" work))]
|
['start (when (verbose) (printf " ~a making ~a\n" id (->rel work)))]
|
||||||
['output (printf " Output from: ~a\n~a~a" work out err)]
|
['done (when (verbose) (printf " ~a made ~a\n" id (->rel work)))]
|
||||||
[else (printf " Error compiling ~a\n~a\n~a~a" work msg out err)]))
|
['output (printf " ~a output from: ~a\n~a~a" id work out err)]
|
||||||
|
[else (printf " ~a error compiling ~a\n~a\n~a~a" id work msg out err)]))
|
||||||
#:options (let ([cons-if-true (lambda (bool carv cdrv)
|
#:options (let ([cons-if-true (lambda (bool carv cdrv)
|
||||||
(if bool
|
(if bool
|
||||||
(cons carv cdrv)
|
(cons carv cdrv)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user