review: perf: override AbstractMap#get in ElementNameMap #4849
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.
This was discovered after rebasing for #4848.
#4832 caused a severe regression due to the way
get
inAbstractMap
works. Before,AbstractMap#entrySet()
just delegated to the underlying map, but with the patch, it first has to build the map. Forget
, this isn't needed at all, therefore we should override the method.This brings down this test
spoon/src/test/java/spoon/test/architecture/SpoonArchitectureEnforcerTest.java
Line 157 in 0fcb288
from ~1m 17s to ~52s. There might be more methods that should be overridden now, I'll investigate that. One that takes a lot of time is
values()
which is called heavily at the moment, but we can avoid many calls with #4848, so both PRs combined seem to achieve even better performance than before the regression.