-
Notifications
You must be signed in to change notification settings - Fork 10
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
Improve clearing Fennels macro-loaded
table when needed.
#117
Comments
in
In some respects I think the performance isn't a huge deal. Compiling is already "slow" compared to anything else, so it being a bit slower (probably not to a noticeable degree unless the given files use lots of complex macros) might be a reasonable trade off for the better diagnostics and clearer-functioning auto-make. Potentially the compile could be run in its own thread, which gets its own state. Either a fresh thread could be built per-compile-entry (probably not "per compile call"), which would incur some start up time and "config" time where hotpot is loaded again, etc (this is ~7-8ms), or a persistent thread could exist that compiles when needed, and nukes the macros-loaded table each time but the performance hit wont be as "felt". The off-thread compile has been considered before (#92, was blocked waiting on nvim 0.8) when working on ruin.fnl which has very complex macros, and is particularly slow when editing large test files that generate 10x lua code. Next:
Then,
|
Macro modules are retained by fennel in a macros-loaded table. If we compile using a macro, then edit the macro, then recompile, we would end up using the older in-memory macro and generate incorrect code. By clearing the macros-loaded table before calling compile, we can enforce that the latest macro code is loaded. Currently this fix only applies to make, but could be extended to diagnostics. See #117.
macro-loaded
table causes stale macro codegen
Mitigation in 9297ab3 |
macro-loaded
table causes stale macro codegenmacro-loaded
table when needed.
Lua is retaining macros modules in memory, so edits to macro files are not reflected in auto-builds without restarting neovim.
Fennel retains a
package.loaded
style list of macro modules it has seen, which we need to clear, exists asmacro-loaded
inspecials.fnl
, but appears to be exposed on the compiler env at some points.The text was updated successfully, but these errors were encountered: