Stefan Israelsson Tampe schreef op zo 27-03-2022 om 11:53 [+0200]: Hmm actually you only have lexical macros that reference module variables. That is not lexical variables which have more optimisation associated with it at least used to. But is better speedwise than the hash lookups I suggested. Anyhow you can create a let with local variables and set them from the module dynamically. Maybe wingos recent work mean that your approach is best. Would be interesting to do some tests to see.  Optimisations are performed at expansion time: (macroexpand #'(let () (use-module/lexical (ice-9 exceptions)) (do-stuff))) ;; the unused imports disappeared! $6 = # A variable is only dereferenced when it is used: ,optimize (let () (use-module/lexical (ice-9 exceptions)) (lambda () raise-continuable)) $7 = (lambda () (@ (ice-9 exceptions) raise-continuable)) So lexical imports should be as fast as directly writing (@ (foo) bar). I don't see how creating new modules at runtime and using 'module-ref' could make things faster (*) here, given that it just seems like an extra layer of indirection and it probably prevents things like inlining. (*) I'm only counting runtime here, not compilation time. Greetings, Maxime.