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

fix(cli-repl): lazy-load dependencies in entry point MONGOSH-1336 #1410

Merged
merged 2 commits into from
Feb 17, 2023

Conversation

addaleax
Copy link
Contributor

Lazy-load most dependencies in the main entry point so as not to have to evaluate their code when running mongosh in very simple cases like --version and --build-info, particularly because the cloud team needs these to be relatively fast.

This results in a ~75% performance improvement for mongosh --version, although it is likely that that difference will be reduced later once/if we enable snapshot support.

(Recommend viewing diff with whitespace disabled)

Lazy-load most dependencies in the main entry point so as not to
have to evaluate their code when running mongosh in very simple
cases like `--version` and `--build-info`, particularly because
the cloud team needs these to be relatively fast.

This results in a ~75% performance improvement for `mongosh --version`,
although it is likely that that difference will be reduced later
once/if we enable snapshot support.
@@ -1,21 +0,0 @@
import { parseCliArgs } from './arg-parser';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still reference to lib/index.js in package.json, we probably should remove it now that this file is gone? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thank you 🙂

@addaleax addaleax merged commit f67d5c3 into main Feb 17, 2023
@addaleax addaleax deleted the 1336-dev branch February 17, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants