Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Making RevCommit object representation more compact in memory

On 8 Oct 2010, at 19:44, Shawn Pearce <spearce@xxxxxxxxxxx> wrote:

On Fri, Oct 8, 2010 at 11:21 AM, Alex Blewitt <alex.blewitt@xxxxxxxxx> wrote:
Using a visitor pattern for processing the parents coupled with using a
different subclass (SingleParentRevCommit vs MultiParentRevCommit) would
avoid the instanceof check.

At the time of allocation we don't know the number of parents.

Is that a limitation of the current implementation or a more significant architectural one?

And
that number might change anyway due to a path limiter killing a merge.
So we can't do that.

...
No.  We rely on reference equality in a lot of the revwalk code.
Creating a new instance would break that.

Does the number of parents increase or the remaining parents change value? If not, we could pass a filter argument into the visitor with known skippable values, such that the filtered parents never show up in the visit. This would also mean nor having to mutate the data structure. 

I was just thinking aloud though - if it can't be done, or it's more inefficient to do this, never mind. 

Alex 

Back to the top