Opened 14 years ago

Closed 12 years ago

#1509 closed defect (fixed)

Modelica.Electrical.Digital needs better performance

Reported by: Per Östlund Owned by: Per Östlund
Priority: high Milestone: 1.9.0
Component: Instantiation Version: trunk
Keywords: Cc: Per Östlund

Description

The Modelica.Electrical.Digital test case takes 250 seconds for me at the moment. 198 of these are spent in the Absyn.MATRIX case of Static.elabExp, due to the large lookup tables of enumeration literals in Modelica.Electrical.Digital.Interfaces.Tables.

The first thing done in the MATRIX case is to elaborate the expressions in the matrix to get the types of them. This leads to a huge number of instantiations of the Modelica.Electrical.Digital.Interfaces package when the lookup looks for the literals. These types are then used to find out the maximum dimension of the matrix and if it contains Reals or not. This information is then given to elabMatrixSemi, which elaborates all expressions again!

One way of speeding this up would be to rewrite the elaboration of matrices so that the type of the previously elaborated element is available when elaborating an element (except for the first element of course). This can then be used to check that all elements have the same type, and also used to simplify the elaborating of enumeration literals. The type of an enumeration literal contains a list of the literals in the enumeration, so this can be used to construct an enumeration literal without lookup it up with Lookup, as well as confirming that it really is an enumeration literal. The elaboration of arrays should probably be rewritten in the same way.

Change History (3)

comment:1 by Martin Sjölund, 14 years ago

r8821 now only elaborates the matrix once (~40% speed-up for me)

comment:2 by Martin Sjölund, 14 years ago

While rewriting poor functions, have a look at elabArray (worst-case: it elaborates the array 3 times before failing; or 2 times before succeeding)

comment:3 by Martin Sjölund, 12 years ago

Cc: perost, → perost
Milestone: 1.9.0
Resolution: fixed
Status: acceptedclosed

Down to 4 seconds for the worst one now, but only 1 second in the frontend.

Note: See TracTickets for help on using tickets.