-
Notifications
You must be signed in to change notification settings - Fork 310
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
git: Only reset Git index if non-empty #3748
Conversation
779d919
to
b74a79a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, do you see any performance improvement in the gix version?
https://github.com/yuja/jj/tree/push-vpsmwmxpokyx
I haven't pushed the gix version because it adds more code, needs cleanup, and lacks testing. If it's faster than the current libgit2 impl, maybe I should restart the rewrite.
In chromium/src.git, this gives an approximate ~0.83s speedup for commands if the Git index is empty, and a ~0.14s slowdown if the Git index is non-empty. As most users using jj will likely be using jj to write to a colocated repo - and therefore avoid modifying the Git index - this should be a general speedup for most colocated checkouts.
b74a79a
to
9e62cb1
Compare
@yuja The gix implementation is noticeably faster! With this PR, it takes around ~3.0s to do a However, it does cause weird things with the state of the git repo - a I also noticed that my p10k git prompt shows a very large number of modified files when it is in this weird state, which is fixed after a (slow)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gix implementation is noticeably faster! With this PR, it takes around ~3.0s to do a
jj abandon
when@
is empty. With your gix implementation, it takes ~2.4s.However, it does cause weird things with the state of the git repo - a
git status
afterwards causes a long "Refresh index" operation (~80s, then ~36s, then ~36s) to occur,
Perhaps, that's because my version doesn't preserve mtime/ctime stored in the index. I haven't noticed it because I don't use git
for working-copy management.
Thanks for testing. I think this PR is good workaround. We'll need some diffing (to copy back mtime/ctime) anyway if we switch to gix.
This accounts for commit message-only changes which do not change the tree ID, as well as checkouts between commits with identical tree contents. See martinvonz#3748 for previous work on avoiding resetting HEAD when the *commits* are identical.
This accounts for commit message-only changes which do not change the tree ID, as well as checkouts between commits with identical tree contents. See martinvonz#3748 for previous work on avoiding resetting HEAD when the *commits* are identical.
This accounts for commit message-only changes which do not change the tree ID, as well as checkouts between commits with identical tree contents. See martinvonz#3748 for previous work on avoiding resetting HEAD when the *commits* are identical.
This accounts for commit message-only changes which do not change the tree ID, as well as checkouts between commits with identical tree contents. See martinvonz#3748 for previous work on avoiding resetting HEAD when the *commits* are identical.
This accounts for commit message-only changes which do not change the tree ID, as well as checkouts between commits with identical tree contents. See #3748 for previous work on avoiding resetting HEAD when the *commits* are identical.
In chromium/src.git, this gives an approximate ~0.83s speedup for commands if the Git index is empty, and a ~0.14s slowdown if the Git index is non-empty.
As most users using jj will likely be using jj to write to a colocated repo - and therefore avoid modifying the Git index - this should be a general speedup for most colocated checkouts.
Checklist
If applicable:
CHANGELOG.md