8000 set `opts.inputFileNames` directly when possible by froydnj · Pull Request #6532 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

set opts.inputFileNames directly when possible #6532

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

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

froydnj
Copy link
Contributor
@froydnj froydnj commented Nov 2, 2022

Motivation

The common case is for Sorbet to be only used with a single input directory, so the common case here is that opts.inputFileNames is originally empty and we're adding all the files we just found to it.

In that case, we can re-use the vector we just allocated, rather than shuffling a bunch of memory around. This saves about 5% of time reading files after #6530 lands on Stripe's codebase.

Test plan

See included automated tests.

@froydnj froydnj 8B63 requested a review from a team as a code owner November 2, 2022 14:53
@froydnj froydnj requested review from jez and removed request for a team November 2, 2022 14:53
@froydnj froydnj merged commit b8f69fe into master Nov 2, 2022
@froydnj froydnj deleted the froydnj-add-files-shortcut branch November 2, 2022 17:38
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
0