

[samth@huor:~/sw/pycket (master) plt] PLT_LINKLET_TIMES=1 pk -l racket/base
;; boot 9 [ 0] ms
;; make-instance 0 [ 0] ms ; 196 times
;; instantiate-linklet 372 [ 22] ms ; 302 times
;; startup 872 [369] ms ; 1 times
;; expander-linklet 1 [ 0] ms ; 1 times
;; json-load 283 [191] ms ; 2 times
;; json-to-ast 586 [178] ms ; 2 times
;; fasl-linklet 0 [ 0] ms ; 1 times
;; set-params 2 [ 0] ms ; 1 times
;; read 1215 [367] ms
;; fasl->s-exp 390 [ 36] ms ; 78 times
;; s-exp->ast 762 [320] ms ; 78 times
;; assign-convert-deserialize 63 [ 11] ms ; 1821 times
;; total 2470 [758] ms

It seems to be fasl->s-exp that’s problematic

PLT_LINKLET_TIMES=1 p -l racket/base
;; boot 2 [0] ms
;; make-instance 0 [0] ms ; 196 times
;; instantiate-linklet 508 [72] ms ; 302 times
;; startup 1080 [441] ms ; 1 times
;; expander-linklet 1 [0] ms ; 1 times
;; json-load 356 [247] ms ; 2 times
;; json-to-ast 713 [193] ms ; 2 times
;; fasl-linklet 0 [0] ms ; 1 times
;; set-params 9 [1] ms ; 1 times
;; read 6618 [500] ms
;; fasl->s-exp 6359 [442] ms ; 78 times
;; s-exp->ast 158 [29] ms ; 78 times
;; assign-convert-deserialize 100 [29] ms ; 1821 times
;; total 8210 [1013] ms

but you made s-exp->ast much faster

fasl->s-exp is also running lots of racket code in a loop

and note that it has no imports



@cadr one way to not load the expander: create a program in racket that uses compile-linklet and instantiate-linklet to run a loop. Then run that program in old pycket, which doesn’t load the expander.


@cadr basically this: #lang racket/base
(define N 10)
(let countdown ([n N]) (if (< n 0) 1 (countdown (- n 1))))
(require racket/linklet)
(define l
(compile-linklet
`(linklet
()
()
(display ((letrec-values (((countdown)
(lambda (n) (if (< n 0) 1 (countdown (- n 1))))))
countdown)
,N)))
))
(void (instantiate-linklet l null))

but note that it need the commit I just pushed

and you probably want to run it with a much larger N to get a trace
