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

[Merged by Bors] - chore(data/hash_map): linting #4498

Closed
wants to merge 6 commits into from
Closed

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Oct 7, 2020

No description provided.

@kmill kmill added awaiting-review The author would like community review of the PR easy < 20s of review time. See the lifecycle page for guidelines. lintfix This PR only fixes linting errors labels Oct 7, 2020
src/data/hash_map.lean Outdated Show resolved Hide resolved
Co-authored-by: Johan Commelin <johan@commelin.net>
## Main definitions

* `hash_map`: constructed with `mk_hash_map`.

Copy link
Member

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.

Copy link
Collaborator Author

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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.

@robertylewis robertylewis added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR easy < 20s of review time. See the lifecycle page for guidelines. labels Oct 7, 2020
@kmill kmill added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Oct 7, 2020
@robertylewis
Copy link
Member

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Oct 12, 2020
bors bot pushed a commit that referenced this pull request Oct 12, 2020
@bors
Copy link

bors bot commented Oct 12, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title chore(data/hash_map): linting [Merged by Bors] - chore(data/hash_map): linting Oct 12, 2020
@bors bors bot closed this Oct 12, 2020
@bors bors bot deleted the kmill_nolint11 branch October 12, 2020 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lintfix This PR only fixes linting errors ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants