<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="en-CZ" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Yes, calculation of hash of class internal name from its descriptor without sub-stringing might help to save some CPU, however it must be benchmarked.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Another (a bit more radical) approach in this specific case is to use CP entries as constants instead of the ClassDescs and MethodTypeDescs.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US">Even more CPU can be saved if the constant CP entries are a part of a constant “template” ClassModel and specific proxy classes are generated as the “template” class
 transformation.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">liangchenblue@gmail.com <liangchenblue@gmail.com><br>
<b>Date: </b>Wednesday, 24 May 2023 6:39<br>
<b>To: </b>Adam Sotona <adam.sotona@oracle.com><br>
<b>Cc: </b>classfile-api-dev <classfile-api-dev@openjdk.org>, asotona@openjdk.org <asotona@openjdk.org><br>
<b>Subject: </b>Re: Benchmarks to check migration impact to j.l.invoke and j.l.reflect.Proxy performance<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank you for the info. I've run the ProxyPerf after edits (removing<br>
obsolete code) and the result doesn't look quite promising. It appears<br>
that the exception handler might be time-consuming.<br>
<br>
I've just found Claes Redestad's talk about lambda and bytecode<br>
generation performance: <a href="https://youtu.be/3r_tHGtpU7A?t=1921">https://youtu.be/3r_tHGtpU7A?t=1921</a><br>
I think I should perform a debug build one day and discover the impact<br>
of string-related operations. My current assumption is that to find a<br>
corresponding ClassEntry in a constant pool, a ClassDesc's descriptor<br>
string must undergo substring and hashCode, which may be costly, so we<br>
might change ClassEntry's hashing strategy so we can just reuse the<br>
cached hashCode of a ClassDesc's descriptorString easily.<br>
<br>
On Tue, May 23, 2023 at 8:38 AM Adam Sotona <adam.sotona@oracle.com> wrote:<br>
><br>
> Hi,<br>
><br>
> For benchmarking Proxies I’ve used <a href="https://github.com/openjdk/jdk/tree/master/test/micro/org/openjdk/bench/java/lang/reflect/Proxy">
https://github.com/openjdk/jdk/tree/master/test/micro/org/openjdk/bench/java/lang/reflect/Proxy</a><br>
><br>
><br>
><br>
> Adam<br>
><br>
><br>
><br>
> From: liangchenblue@gmail.com <liangchenblue@gmail.com><br>
> Date: Tuesday, 23 May 2023 3:49<br>
> To: classfile-api-dev <classfile-api-dev@openjdk.org>, asotona@openjdk.org <asotona@openjdk.org><br>
> Subject: Benchmarks to check migration impact to j.l.invoke and j.l.reflect.Proxy performance<br>
><br>
> Hello Adam,<br>
> Last time, you said that a major obstacle to the migration of Proxy<br>
> and MethodHandle ASM code to Classfile API is the performance<br>
> degradation. I wish you can share how you measured the impact of<br>
> migration, so that I can try for myself and see the performance<br>
> bottlenecks.<br>
><br>
> Chen Liang<o:p></o:p></span></p>
</div>
</div>
</body>
</html>