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

Use async imports when importing anything except types from polykey #283

Open
aryanjassal opened this issue Sep 16, 2024 · 2 comments
Open
Labels
development Standard development

Comments

@aryanjassal
Copy link
Contributor

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

  1. Scan all the files and remove any imports from Polykey, making them async if they are not types.
  2. Implement benchmark testing in the CI to test for performance regression
@aryanjassal aryanjassal added the development Standard development label Sep 16, 2024
Copy link

linear bot commented Sep 16, 2024

@tegefaulkes
Copy link
Contributor

Adding on to this. We need to add benchmarks to check for performance regressions by checking how long running polykey just to get the help text takes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development
Development

No branches or pull requests

2 participants