Opened 8 years ago

Closed 7 years ago

#4454 closed defect (fixed)

Differentiate.differentiateExp speed is poor

Reported by: Henning Kiel Owned by: Lennart Ochel
Priority: high Milestone: 1.12.0
Component: Backend Version: v1.12.0
Keywords: Cc: Adrian Pop, Martin Sjölund, Francesco Casella

Description

The speed of Differentiate.differentiateExp() is poor due to recursion check.

if listMember(inExp, inExpStack) then
  Error.addInternalError("Differentiation failed due to recursion...

When removing the check the time of postOpt tearingSystem goes down from 26s to 2s in ScalableTestSuite.Electrical.BreakerCircuits.ScaledExperiments.BreakerNetwork_N_640

Can this be improved, made optional or removed completely?
listMember() uses valueEq() which seems to be slow for this purpose.

Change History (5)

comment:1 by Henning Kiel, 8 years ago

Cc: Adrian Pop Martin Sjölund added

comment:2 by Lennart Ochel, 8 years ago

Are elements also deleted from the stack? If not, then it might be more efficient to use a hash set.

comment:3 by Henning Kiel, 8 years ago

Cc: Francesco Casella added

Elements are not deleted.

I suggest removing the loop check completely. There is a max. iteration check, so this should catch the loops as well. Anyway, is it really possible, that a loop can happen (at this stage)?

I created PR1698 which removes the loop check completely.

comment:4 by Henning Kiel, 8 years ago

Version 0, edited 8 years ago by Henning Kiel (next)

comment:5 by Henning Kiel, 7 years ago

Resolution: fixed
Status: newclosed

The recursion check is removed completely as it is only a compiler-sanity-check.
PR1698

Note: See TracTickets for help on using tickets.