[nomerge] HashMap#transform reuses structure#8630
Merged
lrytz merged 2 commits intoscala:2.12.xfrom Feb 5, 2020
Merged
Conversation
a3ac91f to
bad3956
Compare
szeiger
reviewed
Jan 13, 2020
| m | ||
| } | ||
| protected override def transformImpl[W](f: (A, B) => W): HashMap[A, W] = { | ||
| new HashMapCollision1[A, W](hash, kvs map { case (k, v) => (k, f(k, v)) }) |
Contributor
There was a problem hiding this comment.
How about kvs.transform(f) since it's also a Map?
Member
|
Needs a rebase (and there's an open review suggestion) |
Contributor
Author
|
Thanks -- I'll see if I can get to this over the weekend |
bad3956 to
6ea8da4
Compare
szeiger
approved these changes
Feb 3, 2020
Contributor
szeiger
left a comment
There was a problem hiding this comment.
MiMa excludes need rebasing (as usual)
Contributor
Author
|
Aw, I just did that, too. |
The keys in the resulting map are the same, so the internal structure will also be the same, and that can be used to avoid allocating tuples and going through `MapBuilder` and other such convolutions.
I thought som-snytt had recently gone on some sort of warning-cleanup mission, but nowadays I can't compile 2.12.x without seeing scala tell me off for these. Well, now I can.
b4c009d to
1cd3e74
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(2.12.x only, of course)
The keys in the resulting map are the same, so the internal structure will also be the same, and that can be used to avoid allocating tuples and going through
MapBuilderand other such convolutions.Benchmark results:
@mkeskells