Bug 416363 - [xbase][performance] Reconsider approach to binary operation resolution
Summary: [xbase][performance] Reconsider approach to binary operation resolution
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.4.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 458534
  Show dependency tree
 
Reported: 2013-09-02 09:54 EDT by Sebastian Zarnekow CLA
Modified: 2017-05-09 08:21 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Zarnekow CLA 2013-09-02 09:54:34 EDT
Binary operations are heavily overloaded method calls in the xbase library. This leads to an exponential number of type checks that has to happen for nested binary operations.

I could be worthwhile to reconsider the linking of binary operations. Rather than having them as overloaded members in the Xbase library we should evaluate the benefit of a specialized resolution for binary operations, e.g. a hardcoded linking.

Performance wise the impact could be tremendous (validate with ArithmeticExtensionsTest.testManyOperations_01())

Another benefit of this approach is that the xbase lib could become fully optional, e.g. if clients want to use Java8 lambdas they could easily avoid the xbase standard lib as a dependency if the operators were not baked into that lib.

Overloading of operators should still be possible, though.
Comment 1 Miro Spönemann CLA 2014-11-25 03:11:42 EST
The following example causes Xtend 2.7.3 to crash the Eclipse process (heap memory overflow, UI becomes unresponsive). If that happens even for such small computations, we really need an improvement in this regard.

private def calcEllipseOffset(double w, double h, double a) {
    if (w >= h) {
        val cosa = cos(a)
        return h / sqrt(1 - (1 - h * h / (w * w)) * cosa * cosa)
    }
}