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 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.  And
that number might change anyway due to a path limiter killing a merge.
 So we can't do that.

> Could you also create a new instance instead of mutating an existing one? In
> most cases you may not need to mutate and could simply return it
> unmolested.

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

-- 
Shawn.


Back to the top