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: change useable ids to set to improve search perf #640

Merged
merged 2 commits into from
Feb 28, 2023
Merged

Conversation

peternhale
Copy link
Contributor

Simple change to improve command lookup perf

src/help/util.ts Outdated
@@ -41,10 +41,10 @@ function collateSpacedCmdIDFromArgs(argv: string[], config: IConfig): string[] {
if (argv.length === 1) return argv

const findId = (argv: string[]): string | undefined => {
const ids = collectUsableIds(config.commandIDs)
const ids = new Set(collectUsableIds(config.commandIDs))
Copy link
Contributor

Choose a reason for hiding this comment

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

@peternhale would it be better to have collectUsableIds return a Set? That way other consumers of it get the performance benefits?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take a look, but yes. would also save the sort op in collectUsableIds

@peternhale peternhale merged commit a0996a4 into main Feb 28, 2023
@peternhale peternhale deleted the phale/perf branch February 28, 2023 16:47
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