Skip to content

Compile times #13

@jkarni

Description

@jkarni

Basically every operation in this library is not very smartly implemented in terms of reducing compile times (e.g. sorting an already sorted list!). Fix this.

  • Don't re-sort on every insertion, but insert at the right place [Is O(n * log n), could be O (log n)]
  • delete (and therefore set and modify) resort the map after deletion, when in fact it is already sorted. It may be hard to convince GHC that is already is sorted, though. In any case, submap probably shouldn't be used - we always want to remove just one element.
  • Settable has a constraint (new ~ Map.AsMap...) to prove something in a costly way that we should already know is true.

In general, I think the right approach is not prove to the compiler that certain operations maintain the set properties, and only have those operations accept sets, but instead just assume the arguments are sets and recover safety by not exposing a way of creating a Book' that doesn't have those properties.

Another interesting possibility is seeing if we can use Data.Type.Equality and unsafeCoerce to have the same type equalities for cheaper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions