Opened 11 years ago

Closed 10 years ago

#2669 closed enhancement (fixed)

Unnecessary function call for returning arrays

Reported by: Willi Braun Owned by: Willi Braun
Priority: high Milestone: 1.9.2
Component: Code Generation Version: trunk
Keywords: Cc:

Description

For the second equation in the example below our code generation generate too many call to the function. For every array output element one call to the function.
That cause performance issue for instance in our fmi import.

loadString("
function f1
  input Real u[:];
  input Integer n;
  output Real y[n];
algorithm
  for i in 1:n loop
    y[i] := sin(u[i]);
  end for;
end f1;
model ArrayReturnFunction
  parameter Integer n = 2;
  Real x[n] = {time, 2*time};
  Real y1[n];
  Real z1,z2;
equation
  y1 = f1(x, n);
  {z1,z2} = f1(x, 2);
end ArrayReturnFunction;
");
getErrorString();
simulate(ArrayReturnFunction);
getErrorString();

Change History (3)

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

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:2 by Willi Braun, 10 years ago

Owner: changed from Lennart Ochel to Willi Braun
Status: newaccepted

comment:3 by Willi Braun, 10 years ago

Resolution: fixed
Status: acceptedclosed

fixed in r24138.

Note: See TracTickets for help on using tickets.