IIUC:
I''m using cs:
as a prefix for Chez Scheme functions, when they are different from the racket ones.
unsafe-set-immutable-car!
is translated as cs:unsafe-set-car!
. I think it has a special case in schemify
, like most build-in racket functions.
unsafe-set-car!
is translated as a function defined by a cs:lambda
in another module, that is not inlined.
Your code is expanded to a linklet
that (after a lot of simplifications and lies) is:
(lambda (globals my-unsafe-set-car!)
(let ([p (cons 1 2)])
(cs:unsafe-set-car! p 7))
(let ([p (cons 1 2)])
((if (cs:procedure? my-unsafe-set-car!)
my-unsafe-set-car!
(slow-extract-function my-unsafe-set-car!))
p 7))
)
I'm surprised it's not even slower.