-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reuse Hy compiler instances #1700
Reuse Hy compiler instances #1700
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hy_eval
is user-visible (as eval
), so update its documentation in core.rst
and NEWS.
In order for a compiler instance to simply [re]use itself when calling To replace For instance, At the very least, these changes would get us closer to a compiler that better isolates its functionality and is significantly easier to extend and debug. Regarding Somewhat related issues: #1542, #1482. Also, this comment in #1697. |
@Kodiologist, good call; will do. |
ede0ab6
to
c117f86
Compare
I'm afraid this isn't rebasing cleanly after merging #1699. Could you take a look? |
Yeah, one minute. |
These changes make `HyREPL` use a single `HyASTCompiler` instance, instead of creating one every time a valid source string is processed. This change avoids the unnecessary re-initiation of the standard library `import` and `require` steps that currently occur within the module tracked by a `HyREPL` instance. Also, one can now pass an existing compiler instance to `hy_repl` and `hy_compiler`. Closes hylang#1698.
c117f86
to
3d0659b
Compare
OK, that should do it. |
Nice. One more thing: the documentation of |
Didn't notice that; I'll update it. Otherwise, it seems like we should really get started on #1044. |
Replace "fifth" with "fourth" and I'll merge. Yep. |
00009b6
to
690416b
Compare
Every call to
hy_eval
andhy_compile
will create a newHyASTCompiler
instance, which incurs Hy standard library setup costs each time. When calls to these functions occur more than once (e.g. by use ofHyREPL
andeval-and-compile
), the aforementioned work is performed unnecessarily for the same module. These changes avoid that unneeded and error-prone repetition.HyREPL
callshy_compile
on every processed command #1698