The original MultiJava code for this benchmark, and the Java comparison code, is available from this Technical Report:
"MultiJava: Design, implementation, and evaluation of a Java-compatible language supporting modular open classes and symmetric multiple dispatch", Curtis Clifton, Iowa State University TR #01-10, November 2001.
ftp://ftp.cs.iastate.edu/pub/techreprts/TR01-10/TR.pdf
Curtis Clifton kindly gave permission for this use.
The performance ratios for MultiJava and Nice are very different - the results are from different machines, and different test iterations but that doesn't seem like an adequate explanation.
| MultiJava | 1,000,000 loops: 140ms |
| | Java double-dispatch | Java typecases |
| | 2,704ms | 4,307ms |
| multiple-dispatch | 4,306ms | 4,306ms |
| speedup | 0.627 | 1.000 |
| Nice 0.9.2 | 1,000,000 loops: 47-63ms |
| | 100,000,000 loops: 4,672ms |
| | Java double-dispatch | Java typecases |
| | 123,125ms | 108,641ms |
| multiple-dispatch | 122,844ms | 122,844ms |
| speedup | 1.002 | 0.884 |
The typecases and double-dispatch implementations are given in the MultiJava report. A single line was changed in both of the Java test driver classes Exercise.java and TestMultipleDispatch.java (to call the Nice multi-dispatch method):
Real result = values[i].multiply1(values[j]);
was changed to
Real result = dispatch.multiply1(values[i],values[j]);
The multi-dispatch methods were placed together in a separate file.
That is different to the MultiJava implementation:
// compilation unit multiply1.nice
package multipledispatch;
import multipledispatch.*;
// Methods using multiple dispatch
Real multiply1(Real this, Real other);
multiply1(Real this, Real other) =
new Real(this.value * other.value());
multiply1(Integer this, Integer other) =
new Integer(lValue * other.getLValue() );
multiply1(Integer this, Rational other) =
new Rational(lValue * other.numerator(), other.denominator() );
multiply1(Rational this, Integer other) =
new Rational( this.numerator * other.getLValue(),
this.denominator );
multiply1(Rational this, Rational other) =
new Rational( this.numerator * other.numerator(),
this.denominator * other.denominator() );
long getLValue(Integer) = native long multipledispatch.Integer.lValue();
-- IsaacGouy - 19 Sep 2003
Revision r1.2 - 24 Dec 2003 - 21:32 GMT - IsaacGouy Parents: WebHome > CodeExamples
|
Copyright © 1999-2003 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.
|
| |