Implement module level (and possibly class-level) loading #840
Labels
enhancement
New feature or request
performance
Something is slow and you have an idea of how to fix it
Add autoload mechanism to speed up start up time allowing and allow load time to be distributed over the execution of functions/features needed.
Starting with GNU-emacs as an example (in Lisp syntax):
(
autoload
FUNCTION FILE &optional DOCSTRING INTERACTIVE TYPE)In our case, FILE would be a Python module import, e.g.
builtin.mathics.quanum_mechanics
or even a Mathics3 module name likepymathics.graph
.We do not need the optional DOCSTRING, INTERACTIVE, or TYPE. Docstring comes from the loaded module. The other optional parameters I don't think are applicable here. As for FUNCTION we would probably collect all of the builtin-functions (class names) into one module-level autoload.
Related is that inside the module we can have additional autoloaded rules written in Mathics3 that are currently in the
autoload/rules
directory, e.g.autoload/rules/Limit.m
which might be moved down under a newcalculus
directory. Or maybe is put insideautoload/rules/calculus.m
. We can decided this based on speed of loading and number of rules in each file.The mechanism for doing this might be having a shadow autoload structure that mirrors the
mathics.builtin
structure. For example, we currently have anautoload
directory which currently has Mathics3 code with extension.m
. So Python code can be put there as well.For module-level autoload:
For a class-level autoload:
Describe alternatives you've considered
Also related bit different is reorganizing the code and the definitions part so that we can load a Python Pickle fragment of various attributes, e.g. Function Rewrite Rules Symbols, and Definition headers.
WMA DumpSave seems to be the WMA equivalent of this.
See also https://reference.wolfram.com/language/workflow/CreateAPackageFile.html
Implementation Suggestion
The way an autoload mechanism works (in GNU Emacs) is that boilerplate code is added for the autoloaded object which performs the loading and overwrites the code portion.
The text was updated successfully, but these errors were encountered: