Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338654

Summary: Replace with -> File in Git index slow for large repository
Product: [Technology] EGit Reporter: Robert Munteanu <robert.munteanu>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: christian.halstrick, daniel_megert, jens.baumgart, markus.kell.r, remy.suen, robin.rosenberg
Version: 0.11   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
YourKit snapshot taken during the discard changes operation none

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.