<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div>
<div style="font-family: Calibri; text-align: left; color: rgb(0, 0, 0); margin-left: 5pt; font-size: 10pt;">
Confidential - Oracle Restricted \Including External Recipients</div>
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Mosin, thanks for the report!</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I have created <a href="https://bugs.openjdk.org/browse/JDK-8378724">https://bugs.openjdk.org/browse/JDK-8378724</a> for further investigation for now.</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Regards, Chen</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg">
<div style="direction: ltr; font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<b>From:</b> amber-dev <amber-dev-retn@openjdk.org> on behalf of Мосин Николай <mosinnik@yandex.ru><br>
<b>Sent:</b> Tuesday, February 24, 2026 10:59 AM<br>
<b>To:</b> amber-dev@openjdk.org <amber-dev@openjdk.org><br>
<b>Subject:</b> [External] : pattern matching performance issue</div>
<div style="direction: ltr;"> </div>
</div>
<div style="line-height: 1px; max-height: 0px; display: none; font-size: 1px; color: rgb(255, 255, 255);">
I faced with degradation of pattern matching switch to analogue if-else with instance of and even on if-else with equals() on classes, 7% degradation to both. First getType: ``` public static byte getType(IBlock block) { Class<?</div>
<div style="line-height: 1px; max-height: 0px; display: none; font-size: 1px; color: rgb(255, 255, 255);">
ZjQcmQRYFpfptBannerStart</div>
<div style="background-color: rgb(96, 190, 235); margin: 0px 0px 10px; padding: 7px 16px 8px; border-top: 4px solid rgb(129, 147, 160); border-radius: 4px; max-width: none; max-height: none; min-width: 200px; display: block;" id="x_pfptBannerqamypde">
<div style="background-color: rgb(96, 190, 235); margin: 1px 0px; max-width: 600px; max-height: none; display: block;" id="x_pfptBannerqamypde">
<div style="background-color: rgb(96, 190, 235); max-width: none; max-height: none; display: block;" id="x_pfptBannerqamypde">
<div style="direction: ltr; text-align: left; line-height: 1.29; font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0);">
<b>This Message Is From an Untrusted Sender</b></div>
</div>
<div style="background-color: rgb(96, 190, 235); margin-top: 2px; max-width: none; max-height: none; display: block;" id="x_pfptBannerqamypde">
<div style="direction: ltr; text-align: left; line-height: 1.5; font-family: Arial, sans-serif; font-size: 12px; color: rgb(0, 0, 0);">
You have not previously corresponded with this sender.</div>
</div>
</div>
<div style="background-color: rgb(96, 190, 235); margin-top: 1px; margin-left: 16px; width: fit-content; max-width: none; max-height: none; display: block;" id="x_pfptBannerqamypde">
<div style="background-color: rgb(96, 190, 235); max-width: none; max-height: none; display: inline-block;" id="x_pfptBannerqamypde">
<div style="margin-top: 3px; margin-bottom: 3px; margin-left: 16px; padding: 7.5px 16px; border-width: 1px; border-style: solid; border-color: rgb(102, 102, 102); border-radius: 2px; width: fit-content; display: inline-block;">
<div style="background-color: rgb(96, 190, 235); max-width: none; max-height: none; display: inline-block;" id="x_pfptBannerqamypde">
<div style="direction: ltr; text-align: right; white-space: nowrap; font-family: Arial, sans-serif; font-size: 14px; color: rgb(0, 0, 0);">
<a style="text-decoration: none; display: inline-block; background-color: rgb(96, 190, 235); max-width: none; max-height: none;" data-auth="NotApplicable" class="OWAAutoLink" id="x_pfptBannerqamypde" href="https://us-phishalarm-ewt.proofpoint.com/EWT/v1/ACWV5N9M2RV99hQ!Nh27domO-0hu9XBh93OV-0_YZO1SZXkSSsbA5RZFwXJx5EWjx3t8aGxGpWxh-HiBGqiWNnqMbGpU-d0$">Report Suspicious</a></div>
</div>
</div>
</div>
</div>
<div style="direction: ltr; text-align: left; line-height: 0; height: 0px; display: block; font-size: 0.01px;">
</div>
</div>
<div style="line-height: 1px; max-height: 0px; display: none; font-size: 1px; color: rgb(255, 255, 255);">
ZjQcmQRYFpfptBannerEnd</div>
<div>I faced with degradation of pattern matching switch to analogue if-else with instance of and even on if-else with equals() on classes, 7% degradation to both.</div>
<div> </div>
<div>First getType:<br>
```</div>
<div> public static byte getType(IBlock block) {</div>
<div> Class<? extends IBlock> blockClass = block.getClass();</div>
<div> if (blockClass.equals(FlatBlock.class)) {</div>
<div> return FLAT_BLOCK;</div>
<div>// and so on</div>
<div>```</div>
<div><br>
</div>
<div>Second getType2:<br>
```</div>
<div> public static byte getType2(IBlock block) {</div>
<div> return switch (block) {</div>
<div> case FlatBlock _ -> FLAT_BLOCK;</div>
<div>// and so on</div>
<div>```</div>
<div> </div>
<div>Third getType3 - got from IDEA auto replacing on getType2 switch:<br>
```</div>
<div> public static byte getType3(IBlock block) {</div>
<div> if (Objects.requireNonNull(block) instanceof FlatBlock) {</div>
<div> return FLAT_BLOCK;</div>
<div>// and so on</div>
<div>```</div>
<div> </div>
<div>JMH results:</div>
<div>```</div>
<div>Benchmark Mode Cnt Score Error Units</div>
<div>GeoDriverBenchParams.getType thrpt 5 7396,383 ± 124,904 ops/s</div>
<div>GeoDriverBenchParams.getType2 thrpt 5 6903,404 ± 119,514 ops/s</div>
<div>GeoDriverBenchParams.getType3 thrpt 5 7455,847 ± 108,161 ops/s</div>
<div>```</div>
<div> </div>
<div>Tested on openjdk and temurin both 25.0.2, both have almost the same values</div>
<div> </div>
<div>What problem could be?</div>
<div> </div>
<div>Repo and jmh to reproduce: https://github.com/mosinnik/l2-geo/blob/sealed_1/src/test/java/ru/mosinnik/l2eve/geodriver/jmh/GeoDriverBenchParams.java</div>
<div><br>
<div style="font-family: Calibri; text-align: left; color: rgb(0, 0, 0); margin-left: 5pt; font-size: 10pt;">
Confidential - Oracle Restricted \Including External Recipients</div>
</div>
</body>
</html>