Repository navigation
Use a spawn API for getting status details - #5053
Conversation
|
@iAmWillShepherd digging into this a bit more, I added some localized timings to the actions that make up diff --git a/app/src/lib/git/status.ts b/app/src/lib/git/status.ts
index 7390d855e..98079820b 100644
--- a/app/src/lib/git/status.ts
+++ b/app/src/lib/git/status.ts
@@ -64,11 +64,14 @@ function convertToAppStatus(status: FileEntry): AppFileStatus {
export async function getStatus(
repository: Repository
): Promise<IStatusResult | null> {
+ console.time(`status git invocation`)
const result = await spawnAndComplete(
['status', '--untracked-files=all', '--branch', '--porcelain=2', '-z'],
repository.path,
'getStatus'
)
+ console.timeEnd(`status git invocation`)
+ console.log(`output length: ${result.output.length}`)
if (result.output.length > MaxStatusBufferSize) {
log.error(
@@ -81,6 +84,7 @@ export async function getStatus(
const stdout = result.output.toString('utf8')
+ console.time(`status parsing`)
// Map of files keyed on their paths.
// Note, map maintains insertion order
const files = new Map<string, WorkingDirectoryFileChange>()
@@ -155,6 +159,7 @@ export async function getStatus(
const workingDirectory = WorkingDirectoryStatus.fromFiles([...files.values()])
+ console.timeEnd(`status parsing`)
return {
currentBranch,
currentTip,This showed how the overall timings were split up when running this on your 100000 untracked files example: Old behaviour: New behaviour: I think that's the core of the performance problem you're seeing - now that Git itself can send the 10MB+ of output it was previously erroring on, we're uncovered a new bottleneck when parsing this much output. |
|
By my count we're spending most of the At quick glance, I'll put together a PR to target this branch and we can see how that affects things. |
|
Out of curiosity, what would happen if you |
…sing Gonna go ahead and merge since this isn't being merged into master.
|
Yes it is! Sorry about that. |
| ) | ||
|
|
||
| if (status == null) { | ||
| return |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| const fields = output.split('\0') | ||
| const tokens = output.split('\0') | ||
| const queue = new Deque(tokens) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Flagging this one as in-scope for |
shiftkey
left a comment
There was a problem hiding this comment.
Close, just one more message to address
| if (status === null) { | ||
| this.props.dispatcher.postError( | ||
| new Error( | ||
| `createRepository: unable to get status for repository at ${fullPath}` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
iAmWillShepherd
left a comment
There was a problem hiding this comment.
I'm approving sine @shiftkey can't approve his own PR and it's just us two reviewing PRs today.
|
Yep, we're limited on reviewers and resources right now - and we believe these changes are of benefit to everyone - so we're going to ensure this gets the maximum time on beta before the next release. #jolo |


Tackling the known bottleneck identified in #2449
Fixes #2449
TODO:
getStatusfails, log and ensure no stale state persisted inGitStoregetStatusreport an error to the user that it wasn't able to complete