Skip to content

PInterval can have more efficient representation for more complicated manipulation  #796

Open
@SeungheonOh

Description

@SeungheonOh

PInterval as it is provided by the ledger api is very inefficient for complicated operations on interval. pcontains as it is is well optimized and having intermediary representation will actually do harm on its performance by introducing extra conversion from ledger type to intermediary type. However, if script requires multiple and more complicated operations(like a series of checking interval union, intersection, etc, etc) on interval, it would be cheaper to convert ledger interval into intermediary interval, do multiple operation on converted interval, and convert back to ledger interval.

Below is possible idea for more efficient intermediary interval proposed by @kozross.

data PClosured (a :: S -> Type) (s :: S) = POpen (Term s a) | PClosed (Term s a)

data PIntervalSensible (a :: S -> Type) (s :: S) = 
   = PNever
   | PAlways
   | PStartNoEnd (Term s (PClosure a)) 
   | PEndNoStart (Term s (PClosure a))
   | PIntervalSensible (Term s (PClosure a)) (Term s (PClosure a))

Because this optimization is very specifically targeted to scripts that require complicated interval operations, this issue will only be implemented upon request if any project need this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions