Use async
imports when importing anything except types from polykey
#283
Labels
development
Standard development
Specification
When we import files, the runtime must import all the related files before it can begin program execution. As such, if large files referencing other files are being imported at the start of a command, then it would introduce significant slowdowns even for simple operations.
To combat this, we import only the local dependencies, as importing local files is fast, and types, as type files won't have links to other files, so importing them shouldn't cause too much impact in performance. We then import other dependencies using an
async
call when needed. This ensures the imports are only run when needed and for commands that requires it, not slowing down the entire program every time it is run because it is importing needless dependencies.Most commands already follow this approach, but some instances of importing large files from Polykey goes under the radar, slowing down the entire program without anyone's knowledge.
Some regression testing for performance can also be done using benchmarks. We will be able to review the trend over time and decide if it needs action or not.
Additional context
Tasks
async
if they are not types.The text was updated successfully, but these errors were encountered: