lightening first-time loading: remove `MatchCore.jl` and remove all macros in MLStyle
thautwarm opened this issue · comments
MLStyle is currently implemented using src/MatchCore.jl
, where the latter is a small and limited pattern matching implementation. It is responsible for a major part of the code latency: expanding MatchCore
-macros is time-consuming for the first load.
Recently, the POC of "dev-only" dependencies is working:
# Virtual.jl
@compile_only using MLStyle
I'd think it's time to bootstrap MLStyle with MLStyle itself now.
Ideally, we can totally remove MatchCore.jl
and all macros used in this project.
The expanded ASTs need to be stored somewhere else, and loaded in a cross-version approach. One way is to use a lower version Julia to serialize the expanded ASTs, and Serialization
in higher version Julia is able to load the code. This avoids introducing runtime dependencies to MLSTyle.
Using BSON
instead of Serialization
is also possible.
A verification mechanism is also needed, because the serialized AST might be modified to have unexpected behaviour.