Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] Performance of commit preparation

We are currently investigating the issue that Team->commit in EGit is slow for big repos.
Team->commit uses IndexDiff to determine what was changed in the repository. This seems to be the same task as is performed when calling git commit in native git (git commit also figures out what is modified, untracked etc.).
The tree walk over repo, workdir and index takes 23 seconds (with empty while loop) for our test repo (linux kernel).
Git commit from native git takes 7 seconds. Is this a realistic relation from C to Java or is there improvement left in the tree walk that calculates the changes? Implementation looks as follows:
 
ObjectId objectId = repository.resolve(Constants.HEAD);
                if (objectId != null)
                        tree = new RevWalk(repository).parseTree(objectId);
 
                DirCache dirCache = repository.readDirCache();
                TreeWalk treeWalk = new TreeWalk(repository);
                treeWalk.reset();
                treeWalk.setRecursive(true);
                // add the trees (tree, dirchache, workdir)
                if (tree != null)
                        treeWalk.addTree(tree);
                else
                        treeWalk.addTree(new EmptyTreeIterator());
                treeWalk.addTree(new DirCacheIterator(dirCache));
                treeWalk.addTree(initialWorkingTreeIterator);
                treeWalk.setFilter(TreeFilter.ANY_DIFF);
                treeWalk.setFilter(AndTreeFilter.create(new TreeFilter[] {
                                new NotIgnoredFilter(WORKDIR), new SkipWorkTreeFilter(INDEX),
                                TreeFilter.ANY_DIFF }));
                while (treeWalk.next()) {
 
Remark 1: the body of the while loop only takes minor part of execution time (~1s)
 
Remark 2: we tried an FileTreeIterator instead of  AdaptableFileTreeItereator for the workdir but this made things slower.
 
--Jens
 

Back to the top