Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338654 - Replace with -> File in Git index slow for large repository
Summary: Replace with -> File in Git index slow for large repository
Status: RESOLVED WORKSFORME
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 0.11   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-02 07:01 EST by Robert Munteanu CLA
Modified: 2013-01-01 18:46 EST (History)
6 users (show)

See Also:


Attachments
YourKit snapshot taken during the discard changes operation (701.28 KB, application/octet-stream)
2011-03-02 07:03 EST, Robert Munteanu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Munteanu CLA 2011-03-02 07:01:43 EST
The discard changes operation runs for about 5 minutes on a largish repository ( 8k files, 1k directories ). I will attach a YourKit snapshot shortly.
Comment 1 Robert Munteanu CLA 2011-03-02 07:03:19 EST
Created attachment 190132 [details]
YourKit snapshot taken during the discard changes operation

I only timed part of it, as I got bored, but the root cause is clear.
Comment 2 Robin Rosenberg CLA 2013-01-01 18:46:55 EST
Tried here with my latest fixes in Gerrit on a repo with 80k files, 40k tracked and that took about a minute (admittedly on SSD disk) so I think the issue
is no longer valid. C Git is still quite a lot faster, but 1 minute is still a small time compared to what git will do.

A faster way is usually to do a hard reset, but typically accomplished the same thing. There are some differences like assume-valid, which replace will ignore
and overwrite anyway, i.e. replace is a little "harder" than a hard reset.  

I did a test here and it turn out C git reset files with the assume valid flag
set, so maybe we should do the same. Reset also operates on the whole repository. C Git is also a bit faster even though it forcefully replaces all files without checking the index.