MC ancestry slowness

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MC ancestry slowness

Andreas.Raab
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

Reply | Threaded
Open this post in threaded view
|

Re: MC ancestry slowness

Bert Freudenberg
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 -



Reply | Threaded
Open this post in threaded view
|

Re: MC ancestry slowness

Andreas.Raab
Bert Freudenberg wrote:
> 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.

If you have any confidence in the change, please do. My problem is that
I don't understand what exactly is going on in the search and
consequently I'm not sure how to prune the search properly. Great
example why tests are no replacement for comments btw.

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Re: MC ancestry slowness

Bert Freudenberg
On 19.12.2009, at 16:26, Andreas Raab wrote:

>
> Bert Freudenberg wrote:
>> 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.
>
> If you have any confidence in the change, please do. My problem is that I don't understand what exactly is going on in the search and consequently I'm not sure how to prune the search properly. Great example why tests are no replacement for comments btw.
>
> Cheers,
>  - Andreas

I'm pretty sure this is fine. Apparently I added the same check to addVersionInfo: in 2005 ;)

Committed.

- Bert -