[Mono-dev] compiler method chaining

Pete Erickson petee at mindtouch.com
Sun Dec 9 17:53:20 EST 2007


I've noticed a bug with mcs/gmcs with method chaining.  Below is a test 
case and sample compilations.  This test was with mono 1.2.6 preview 2 
(Mac OS X) but the same happens on 1.2.5 from debian lenny.

I tried submitting this to bugzilla but verifying my email address is 
apparently broken. 

Thanks,
pete



//----------------
using System;

public class ChainTest {
    public ChainTest Chain() {
        return this;
    }
    public static void Main(String[] args) {
        ChainTest test = new ChainTest();
        test
            .Chain().Chain().Chain().Chain().Chain()
            .Chain().Chain().Chain().Chain().Chain()
            .Chain().Chain().Chain().Chain().Chain()
    ;
    }
}
//------------------

10 chained calls:
frog:~/monotest petee$ time gmcs ChainTest.cs

real    0m0.615s
user    0m0.465s
sys     0m0.060s

15 chained calls: 
frog:~/monotest petee$ time gmcs ChainTest.cs

real    0m0.759s
user    0m0.592s
sys     0m0.063s

20 chained calls:
frog:~/monotest petee$ time gmcs ChainTest.cs

real    0m5.780s
user    0m5.341s
sys     0m0.184s

21 chained calls:
frog:~/monotest petee$ time gmcs ChainTest.cs

real    0m11.057s
user    0m10.260s
sys     0m0.314s

22 chained calls:
frog:~/monotest petee$ time gmcs ChainTest.cs

real    0m21.496s
user    0m20.076s
sys     0m0.561s

23 chained calls:
frog:~/monotest petee$ time gmcs ChainTest.cs

real    0m41.818s
user    0m39.592s
sys     0m1.018s




More information about the Mono-devel-list mailing list