Project

General

Profile

Bug #9197

continue investigation for performance of default methods

Added by Constantin Asofiei almost 2 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#2 Updated by Constantin Asofiei almost 2 years ago

In #9168, default interface methods were removed for DMOs, static frames and other cases, to reduce class loading time and metaspace size.

From #9168-10:

Second phase needs to address/investigate (in another branch):
  • static MENU definitions:
    interface com.goldencode.p2j.ui.client.MenuStructure
    public default com.goldencode.p2j.ui.client.Menu com.goldencode.p2j.ui.client.MenuStructure.getParentMenu()
    public default com.goldencode.p2j.ui.client.SubMenu com.goldencode.p2j.ui.client.MenuStructure.getParentSubMenu()
    public default com.goldencode.p2j.ui.client.SubMenu com.goldencode.p2j.ui.client.MenuStructure.getRootSubMenu()
    public default com.goldencode.p2j.ui.client.MenuStructure com.goldencode.p2j.ui.client.MenuStructure.getParentSubMenuBody()
    public default com.goldencode.p2j.ui.client.widget.AbstractContainer com.goldencode.p2j.ui.client.MenuStructure.getParentMenuContainer()
    
    interface com.goldencode.p2j.ui.MenuInterface
    public default void com.goldencode.p2j.ui.MenuInterface.activate()
    
  • I'm not sure about Finalizable:
    interface com.goldencode.p2j.util.Finalizable
    public default void com.goldencode.p2j.util.Finalizable.initFailure()
    public default com.goldencode.p2j.security.WeightFactor com.goldencode.p2j.util.Finalizable.weight()
    public default void com.goldencode.p2j.util.Finalizable.entry()
    
  • lambdas related to 4GL FINALLY blocks - this I think can be fixed by removing getTransactionType and hard-coding the TX type via a switch:
    interface com.goldencode.p2j.util.Fini
    public default com.goldencode.p2j.util.BlockManager$TransactionType com.goldencode.p2j.util.Fini.getTransactionType()
    
    interface com.goldencode.p2j.util.SubTxFini
    public default com.goldencode.p2j.util.BlockManager$TransactionType com.goldencode.p2j.util.SubTxFini.getTransactionType()
    
    interface com.goldencode.p2j.util.TxFini
    public default com.goldencode.p2j.util.BlockManager$TransactionType com.goldencode.p2j.util.TxFini.getTransactionType()
    
  • lambdas emitted during conversion:
    interface com.goldencode.p2j.persist.CharacterExpr
    public default java.lang.Class com.goldencode.p2j.persist.CharacterExpr.getType()
    
    interface com.goldencode.p2j.persist.DateExpr
    public default java.lang.Class com.goldencode.p2j.persist.DateExpr.getType()
    
    interface com.goldencode.p2j.persist.DatetimeExpr
    public default java.lang.Class com.goldencode.p2j.persist.DatetimeExpr.getType()
    
    interface com.goldencode.p2j.persist.DatetimeTzExpr
    public default java.lang.Class com.goldencode.p2j.persist.DatetimeTzExpr.getType()
    
    interface com.goldencode.p2j.persist.DecimalExpr
    public default java.lang.Class com.goldencode.p2j.persist.DecimalExpr.getType()
    
    interface com.goldencode.p2j.persist.Int64Expr
    public default java.lang.Class com.goldencode.p2j.persist.Int64Expr.getType()
    
    interface com.goldencode.p2j.persist.IntegerExpr
    public default java.lang.Class com.goldencode.p2j.persist.IntegerExpr.getType()
    
    interface com.goldencode.p2j.persist.LogicalExpr
    public default java.lang.Class com.goldencode.p2j.persist.LogicalExpr.getType()
    
    interface com.goldencode.p2j.persist.RawExpr
    public default java.lang.Class com.goldencode.p2j.persist.RawExpr.getType()
    
    interface com.goldencode.p2j.persist.RecidExpr
    public default java.lang.Class com.goldencode.p2j.persist.RecidExpr.getType()
    
    interface com.goldencode.p2j.persist.RowidExpr
    public default java.lang.Class com.goldencode.p2j.persist.RowidExpr.getType()
    

From #9168-19:

I've done a simple test of loading lambdas into memory. This was 100 classes with 5000 lambdas each, 1000 per method, doing a simple l.add(() -> i1 * 1); to force the load, where the functional interface extends Supplier and defines or not a default method.

The test was compiled (and ran) with Java 8 and Java 17. The results were:
  • java 8 (default method vs without default):
    • metaspace: 921MB vs 885MB
    • time: 24 seconds vs 22 seconds
  • java 17 (default method vs without default):
    • metaspace: 894MB vs 867MB
    • time: 17 seconds vs 16 seconds

Java 17 is faster at loading them than Java 8, but the difference in metaspace usage I think is too small to care for now about the Expr lambdas. For now, I think we can leave it as is.

Also available in: Atom PDF