Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile times #13

Open
3 tasks
jkarni opened this issue Aug 25, 2016 · 0 comments
Open
3 tasks

Compile times #13

jkarni opened this issue Aug 25, 2016 · 0 comments

Comments

@jkarni
Copy link
Contributor

jkarni commented Aug 25, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant