-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce the jar size by 400kb (codegen)
When introducing code generation for the entry and cache, it was overly optimistic and aggressive. That resulted in a larger binary and slow byte code verification. The type hierarchy was optimized and the least useful cases were promoted back to declared references. The CacheLoader reference is another memory optimization that can be rolled back. It should be very commonly used, as we strongly recommend using a self populating cache instead of a manual one. The difference is 14k lines generated (400kb), which is a lot less byte code that might be verified.
- Loading branch information
Showing
9 changed files
with
22 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,6 @@ | |
|
||
import javax.lang.model.element.Modifier; | ||
|
||
import com.github.benmanes.caffeine.cache.local.AddCacheLoader; | ||
import com.github.benmanes.caffeine.cache.local.AddConstructor; | ||
import com.github.benmanes.caffeine.cache.local.AddDeques; | ||
import com.github.benmanes.caffeine.cache.local.AddExpirationTicker; | ||
|
@@ -71,14 +70,14 @@ | |
* @author [email protected] (Ben Manes) | ||
*/ | ||
public final class LocalCacheFactoryGenerator { | ||
final Feature[] featureByIndex = new Feature[] {null, null, Feature.LOADING, Feature.LISTENING, | ||
final Feature[] featureByIndex = new Feature[] {null, null, Feature.LISTENING, | ||
Feature.STATS, Feature.MAXIMUM_SIZE, Feature.MAXIMUM_WEIGHT, Feature.EXPIRE_ACCESS, | ||
Feature.EXPIRE_WRITE, Feature.REFRESH_WRITE}; | ||
final List<LocalCacheRule> rules = ImmutableList.of(new AddSubtype(), new AddConstructor(), | ||
new AddKeyValueStrength(), new AddCacheLoader(), new AddRemovalListener(), | ||
new AddStats(), new AddExpirationTicker(), new AddMaximum(), new AddFastPath(), | ||
new AddDeques(), new AddExpireAfterAccess(), new AddExpireAfterWrite(), | ||
new AddRefreshAfterWrite(), new AddWriteQueue(), new Finalize()); | ||
new AddKeyValueStrength(), new AddRemovalListener(), new AddStats(), | ||
new AddExpirationTicker(), new AddMaximum(), new AddFastPath(), new AddDeques(), | ||
new AddExpireAfterAccess(), new AddExpireAfterWrite(), new AddRefreshAfterWrite(), | ||
new AddWriteQueue(), new Finalize()); | ||
final NavigableMap<String, ImmutableSet<Feature>> classNameToFeatures; | ||
final Path directory; | ||
|
||
|
@@ -204,7 +203,6 @@ private static String encode(String className) { | |
.replaceFirst("WEAK_KEYS", "W") | ||
.replaceFirst("_STRONG_VALUES", "S") | ||
.replaceFirst("_INFIRM_VALUES", "I") | ||
.replaceFirst("_LOADING", "Lo") | ||
.replaceFirst("_LISTENING", "Li") | ||
.replaceFirst("_STATS", "S") | ||
.replaceFirst("_MAXIMUM", "M") | ||
|
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
45 changes: 0 additions & 45 deletions
45
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/AddCacheLoader.java
This file was deleted.
Oops, something went wrong.
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