mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
Eval speedup for lexical-ref
* module/ice-9/eval.scm (primitive-eval): Specialize lexical-ref for depths 0, 1, and 2. Speeds up this test by around 13%: (primitive-eval '(let lp ((n 0)) (when (< n #e1e7) (lp (1+ n)))))
This commit is contained in:
parent
ac5a05d02e
commit
25738ec35d
1 changed files with 5 additions and 2 deletions
|
@ -119,8 +119,11 @@
|
|||
(proc arg ...))))
|
||||
|
||||
(define (compile-lexical-ref depth width)
|
||||
(lambda (env)
|
||||
(env-ref env depth width)))
|
||||
(case depth
|
||||
((0) (lambda (env) (env-ref env 0 width)))
|
||||
((1) (lambda (env) (env-ref env 1 width)))
|
||||
((2) (lambda (env) (env-ref env 2 width)))
|
||||
(else (lambda (env) (env-ref env depth width)))))
|
||||
|
||||
(define (primitive=? name loc module var)
|
||||
"Return true if VAR is the same as the primitive bound to NAME."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue