measure resolver time instead of resolve calls in instantiate

The total time of module name resolver calls is more useful, because
each one takes longer, there should be many fewer, and there are
tasks that end up resolving module paths.
This commit is contained in:
Matthew Flatt 2019-06-11 15:53:00 -06:00
parent a0ce64c5c4
commit 41dc6f1335
3 changed files with 563 additions and 560 deletions

View File

@ -2,6 +2,7 @@
(require racket/private/place-local (require racket/private/place-local
ffi/unsafe/atomic ffi/unsafe/atomic
"../compile/serialize-property.rkt" "../compile/serialize-property.rkt"
"../common/performance.rkt"
"contract.rkt" "contract.rkt"
"parse-module-path.rkt" "parse-module-path.rkt"
"intern.rkt") "intern.rkt")
@ -200,13 +201,15 @@
(define/who (module-path-index-resolve mpi [load? #f]) (define/who (module-path-index-resolve mpi [load? #f])
(check who module-path-index? mpi) (check who module-path-index? mpi)
(or (module-path-index-resolved mpi) (or (module-path-index-resolved mpi)
(let ([mod-name ((current-module-name-resolver) (let ([mod-name (performance-region
(module-path-index-path mpi) ['eval 'resolver]
(module-path-index-resolve/maybe ((current-module-name-resolver)
(module-path-index-base mpi) (module-path-index-path mpi)
load?) (module-path-index-resolve/maybe
#f (module-path-index-base mpi)
load?)]) load?)
#f
load?))])
(unless (resolved-module-path? mod-name) (unless (resolved-module-path? mod-name)
(raise-arguments-error 'module-path-index-resolve (raise-arguments-error 'module-path-index-resolve
"current module name resolver's result is not a resolved module path" "current module name resolver's result is not a resolved module path"

View File

@ -372,9 +372,7 @@
#:seen [seen #hasheq()]) #:seen [seen #hasheq()])
(unless (module-path-index? mpi) (unless (module-path-index? mpi)
(error "not a module path index:" mpi)) (error "not a module path index:" mpi))
(define name (performance-region (define name (module-path-index-resolve mpi #t))
['eval 'resolve]
(module-path-index-resolve mpi #t)))
(define m (namespace->module ns name)) (define m (namespace->module ns name))
(unless m (raise-unknown-module-error 'instantiate name)) (unless m (raise-unknown-module-error 'instantiate name))
(define (instantiate! instance-phase run-phase ns) (define (instantiate! instance-phase run-phase ns)

File diff suppressed because it is too large Load Diff