Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] File insert performance related to DirCacheTree

Hi,

I have a question around inserting new files with JGit. I insert files into the repository via a DirCacheEditor (similar to this snippet):

final ObjectId objectId = objectInserter.insert(OBJ_BLOB, object);

dirCacheEditor.add(new PathEdit(path.toString())...

dirCacheEditor.finish();

dirCache.writeTree(objectInserter);


The DirCache I retrieve the editor from is already fully initialised via a builder. What I can see now in my ObjectInserter is that the DirCacheTree belonging to the DirCache is calling itself recursively for all trees contained in the directory (despite if they had changed or not) and calling the insert method on the ObjectInserter (delegated through the TreeFormatter). This has a huge performance impact on my application, since I have many entries and the default use case is that only one of this entries is modified. I can see that the existing CacheTree (which already contains the id's of the trees) is removed once I call dirCacheEditor.finish().

So my question is whether there is another approach which would scale better for my use case? Like reusing the tree ids which are already known and only insert those which have changed. Or is there something I am doing completely wrong anyway :-)

Thanks,
Philipp

Back to the top