-
Notifications
You must be signed in to change notification settings - Fork 297
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
[Merged by Bors] - chore(data/hash_map): linting #4498
Conversation
Co-authored-by: Johan Commelin <johan@commelin.net>
## Main definitions | ||
|
||
* `hash_map`: constructed with `mk_hash_map`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add an "implementation details" section that says a little bit about the construction? In particular, they're built around arrays, which have some overhead. The VM will destructively update arrays when there's only a single reference, but Lean's reference counting is pretty opaque and hard to predict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some more detail based on my understanding of the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robertylewis When this structure was written, arrays were implemented in C++ as parray
, which has fairly good performance even if the array is shared, by strategically deferring updates in some way. I recall there being a push to replace that with plain arrays, which have a much worse performance cliff if you aren't careful to use the value linearly, but I forget if that ever landed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@digama0 It's probably been at least two years since I tried to use hash_map
or array
but I remember having major issues last time. Is the doc string here accurate to your understanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@digama0 No, that change never landed. Particularly with monads it was very easy to cause non-linearity.
bors merge |
Pull request successfully merged into master. Build succeeded: |
No description provided.