More efficiently create some vectors
And instrument the inferior memory after creating the gds-inferior-packages vector.
This commit is contained in:
parent
ca5f0036f3
commit
ebeb4212ff
1 changed files with 28 additions and 11 deletions
|
|
@ -541,8 +541,13 @@
|
|||
(/ (assoc-ref stats 'heap-size)
|
||||
(expt 2. 20)))))
|
||||
|
||||
(let ((vec (list->vector
|
||||
(iota ,count ,start-index))))
|
||||
(let ((vec (make-vector ,count)))
|
||||
(vector-fold
|
||||
(lambda (i index _)
|
||||
(vector-set! vec i index)
|
||||
(1+ index))
|
||||
,start-index
|
||||
vec)
|
||||
(vector-map!
|
||||
(lambda (_ index)
|
||||
(define package (vector-ref gds-inferior-packages index))
|
||||
|
|
@ -736,18 +741,30 @@
|
|||
|
||||
(inferior-eval
|
||||
`(define gds-inferior-packages
|
||||
(make-vector ,deduplicated-packages-length))
|
||||
(vector ,@(map inferior-package-id deduplicated-packages)))
|
||||
inf)
|
||||
(inferior-eval
|
||||
'(begin
|
||||
(vector-map!
|
||||
(lambda (_ id)
|
||||
(or (hashv-ref %package-table id)
|
||||
(error "missing package id")))
|
||||
gds-inferior-packages)
|
||||
#t)
|
||||
inf)
|
||||
|
||||
(inferior-eval
|
||||
`(for-each
|
||||
(lambda (index id)
|
||||
(vector-set! gds-inferior-packages
|
||||
index
|
||||
(or (hashv-ref %package-table id)
|
||||
(error "missing package id"))))
|
||||
(iota ,deduplicated-packages-length)
|
||||
(list ,@(map inferior-package-id deduplicated-packages)))
|
||||
'(let ((stats (gc-stats)))
|
||||
(simple-format
|
||||
(current-error-port)
|
||||
"post gds-inferior-packages inferior heap: ~a MiB used (~a MiB heap)~%"
|
||||
(round
|
||||
(/ (- (assoc-ref stats 'heap-size)
|
||||
(assoc-ref stats 'heap-free-size))
|
||||
(expt 2. 20)))
|
||||
(round
|
||||
(/ (assoc-ref stats 'heap-size)
|
||||
(expt 2. 20)))))
|
||||
inf)
|
||||
|
||||
(values (list->vector deduplicated-packages)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue