Skip to content

Record productions have exponential behavior #1942

@radumereuta

Description

@radumereuta

Old title: computeOverloadPOSet worst case takes 81s

This worst-case gets activated in one of the definitions @virgil-serbanuta is working on.
Test definition:
https://github.com/radumereuta/verified-smart-contracts/tree/multisig.new/multisig/protocol-correctness/proof/functions
Run as:
kompile -I ../../../ --backend haskell functions-execute.k -v --profile-rule-parsing --debug
kprove proof-count-can-sign.k -v

I'm currently investigating, and I'm making this issue to keep track of progress.
Update 1:

syntax StateCell ::= invariantStateFull(
      numUsers:Usize,
      userIdToAddress:Map,
      addressToUserId:Map,
      numBoardMembers:Usize,
      numProposers:Usize,
      userIdToRole:Map,
      quorum:Usize,
      actionLastIndex:Usize,
      actionData:Map,
      actionSigners:Map,
      callerAddress:KItem,
      stack:Stack,
      variables:Map,
      performedActions:List)  [function, functional]

This is one of the productions that takes a very long time to run computeOverloadPOSet.
Update 2:
This slowdown is because of how we parse record productions.
At parsing time there are 16385 overloads for invariantStateFull (arity 14), 8193 for invariantStateStack (arity 13), 2049 for invariantState (arity 11), 1025 for invariantMultisigState (arity 10), and many others with mere hundreds.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions