Repository navigation
improve status parsing with this one weird trick - #5186
Merged
iAmWillShepherd merged 2 commits intoJul 18, 2018
Merged
iAmWillShepherd merged 2 commits into
iAmWillShepherd merged 2 commits into
Conversation
shiftkey
force-pushed
the
shiftkey/improved-porcelain-parsing
branch
from
July 18, 2018 16:00
e8b698e to
3b7af92
Compare
Member
Author
|
@iAmWillShepherd just a heads up, this one is another "PR into PR branch" so it won't be picked up by some of the CI providers. VSTS will catch all three platforms at least, so I think we're good for coverage. |
3 tasks done
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I uncovered in #5053 (comment) that's there's a known O(N) issue with using
Array.shiftto return the first element from an array. This meansparsePorcelainStatuscan spend a significant amount of it's time churning on an array that's 100000 items or so (which can easily happen when users have a lot of untracked files by mistake).The V8 team do have some tricks for optimizing this, but this discussion shows that it shouldn't be relied upon:
So I stumbled upon
double-ended-queuewhich talks about this in more detail, and offers an easy way to convert an array to a queue.Benchmarking
This is more paper-napkin-esque timings using the live app than any sort of structured benchmarking, but here's where I added timings to the
getStatuscall so I can see how time is spent:So these numbers below represent:
status git invocation- the time to spawn Git and return the outputparse porcelain- the time to parse the raw status outputstatus parsing- the full time to parse the output from Git (includesparse porcelain)Benchmarking with clean working directory (
atom/atom)Base branch:
This PR:
Benchmarking with 50 deleted files (
desktop/desktop)Base branch:
This PR:
Benchmarking with 100000 untracked files (this sample repo)
Base branch:
This PR: