mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 13:37:33 +02:00
Speed up free-vars checking for primitives
We know prims are only symbols, so instead of checking for primitives in the top-level cond (which is expensive) we check for it as a sub-condition off of the (ref?) condition. This lets us avoid a call to memq unless we already are inspecting a symbol.
This commit is contained in:
parent
dd9b612be4
commit
70b27ccd22
1 changed files with 7 additions and 4 deletions
|
@ -705,12 +705,15 @@ if (acc) {
|
|||
(difference (reduce union (map search (ast:lambda-body exp)) '())
|
||||
(ast:lambda-formals->list exp)))
|
||||
((const? exp) '())
|
||||
((prim? exp) '())
|
||||
((quote? exp) '())
|
||||
((ref? exp)
|
||||
(if (member exp let-vars)
|
||||
'()
|
||||
(if bound-only? '() (list exp))))
|
||||
(cond
|
||||
((prim? exp)
|
||||
'())
|
||||
(else
|
||||
(if (member exp let-vars)
|
||||
'()
|
||||
(if bound-only? '() (list exp))))))
|
||||
((lambda? exp)
|
||||
(difference (reduce union (map search (lambda->exp exp)) '())
|
||||
(lambda-formals->list exp)))
|
||||
|
|
Loading…
Add table
Reference in a new issue