[squeak-dev] MC ancestry slowness

Bert Freudenberg bert at freudenbergs.de
Sat Dec 19 14:59:41 UTC 2009

On 19.12.2009, at 15:31, Andreas Raab wrote:
> Hi -
> I'm trying to make sure we can update all the way from 3.10 to 3.11 and ran into a particular problem. It appears that the ancestry computation of MC can be *extremely* inefficient at times. Here is the example that I found to be the current culprit:
> "find the versions involved in the problem"
> workingCopy := (MCPackage named: 'Monticello') workingCopy.
> info := workingCopy ancestors first.
> all := MCVersionSorter new allAncestorsOf: info.
> base := all detect:[:any| any name = 'Monticello-ar.323'].
> root := all detect:[:any| any name = 'Monticello-ar.321'].
> "this is the actual operation"
> base allAncestorsOnPathTo: root.
> This will basically hang - I've not found enough patience so far to wait if it ever completes (I think it eventually will; it just appears to be an exponential search tree depending on the number of branches).
> Since there is only one current user of this operation (MCConfiguration>>logUpdate:with:) I'm inclined to have this operation be guarded via something like here:
> 	[aVersion info allAncestorsOnPathTo: each]
> 		valueWithin: 5 seconds onTimeout:[#()]
> to avoid hanging in the update process.
> Comments?
> Cheers,
>  - Andreas

I'd rather prune the search. I think inserting this line

	(aVersionInfo hasAncestor: target) ifFalse: [^false].

before "self pushLayer" in MCFilteredVersionSorter>>processVersionInfo: would do the trick. At least in your example it works fine.

- Bert -

More information about the Squeak-dev mailing list