Skip to content
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

HyREPL calls hy_compile on every processed command #1698

Closed
brandonwillard opened this issue Nov 9, 2018 · 1 comment
Closed

HyREPL calls hy_compile on every processed command #1698

brandonwillard opened this issue Nov 9, 2018 · 1 comment

Comments

@brandonwillard
Copy link
Member

HyREPL calls hy_compile on every processed command. When that happens, a HyASTCompiler is constructed and all the stdlib imports are triggered again and again.

We should probably create and reuse a single HyASTCompiler instance for the lifetime of HyREPL, no?

Originally posted by @brandonwillard in https://github.com/hylang/hy/issue_comments#issuecomment-437527370

@Kodiologist
Copy link
Member

Probably.

brandonwillard added a commit to brandonwillard/hy that referenced this issue Nov 11, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants