Opened 2 years ago

Last modified 20 months ago

## #5373 new defect

# Time complexity issues in constant folding

Reported by: | jsten | Owned by: | jsten |
---|---|---|---|

Priority: | major | Milestone: | |

Component: | Modelica/MiddleEnd | Version: | trunk |

Keywords: | Cc: |

### Description

Constant folding of big expression trees causes bad time complexity. The following model shows the problem:

model A constant Integer n = 100; Real A[n,n] = identity(n); Real x[n]; equation der(x) = A * x + B; end A;

It takes ~30 seconds in the step after variability propagation. The reason is due to folding of the big expressions caused by the matrix multiplication. My initial guess is that the underlying cause is due to the fact that constant folding uses rewrites to perform the folding. Rewrite in big non-final trees are bad, that is exactly what we have here.

### Change History (2)

### comment:1 Changed 2 years ago by

Milestone: | 2.1.x → 2.2.x |
---|

### comment:2 Changed 20 months ago by

Milestone: | 2.2.x |
---|

**Note:**See TracTickets for help on using tickets.

Ticket retargeted after milestone closed