-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Megamorphic methods, move outta here!
This is part of a potentially-large effort to reduce the number of implementations of common interfaces, like Collection and Set, that might be passed at any of an individual program's frequent callsites. Arrays.asList() and Collections.emptySet() are serious offenders here, each defining its own class it returns but that is used nowhere else. If you expect an ArrayList, then use Maker.makeList(), which now has an optimization for the one-argument case. If you expect an OrderedSet, there's Maker.makeOS(), but if you expect it to be empty, just use new OrderedSet<>() rather than Collections.emptySet(). Similarly, there's Maker.makeUOS() for UnorderedSet instances. If you want to know the effect this can have, see this Guava issue google/guava#1268 ; a 20x slowdown can happen at megamorphic callsites. There's an explanation of the terms I used here http://insightfullogic.com/2014/May/12/fast-and-megamorphic-what-influences-method-invoca/ .
- Loading branch information
1 parent
37e0f27
commit 8ac91c8
Showing
98 changed files
with
7,670 additions
and
14,073 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.