<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=us-ascii">
<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:12.0pt;
font-family:"Calibri",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="DE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="color:#212121">Hi,<o:p></o:p></span></p>
<p class="MsoNormal" style="caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#212121"> <o:p></o:p></span></p>
<p class="MsoNormal" style="caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#1F2328;background:white">I've been profiling our compilation tasks lately and noticed that </span><code><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F2328">List.map</span></code><span lang="EN-US" style="color:#1F2328;background:white"> is
under the top consumers.</span><span lang="EN-US" style="color:#212121"><o:p></o:p></span></p>
<p class="MsoNormal" style="caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#1F2328;background:white"> </span><span lang="EN-US" style="color:#212121"><o:p></o:p></span></p>
<p class="MsoNormal" style="caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#1F2328;background:white">There are probably more aggressive options to optimize<span class="apple-converted-space"> </span></span><code><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F2328">List.map</span></code><span lang="EN-US" style="color:#1F2328;background:white"> ,
but I found that checking for empty lists already reduces the overall allocations by ~500MB for one of our compilation tasks with no measurable regressions (but also no noticeable improvements) in timings.<span class="apple-converted-space"> </span></span><span lang="EN-US" style="color:#212121">See<span class="apple-converted-space"> </span></span><span style="color:#212121"><a href="https://github.com/openjdk/jdk/pull/13407" title="https://github.com/openjdk/jdk/pull/13407"><span lang="EN-US" style="color:#0078D7">https://github.com/openjdk/jdk/pull/13407</span></a></span><span class="apple-converted-space"><span lang="EN-US" style="color:#212121"> </span></span><span lang="EN-US" style="color:#212121">for
more information and some screenshots.<o:p></o:p></span></p>
<p class="MsoNormal" style="caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#212121"> <o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#1F2328">In case you consider this worthwhile, I'd appreciate a sponsoring of this (including a ticket because I have no rights to create one, review etc.). I've found </span><span style="color:#1F2328"><a href="https://bugs.openjdk.org/browse/JDK-8032359" title="https://bugs.openjdk.org/browse/JDK-8032359"><span lang="EN-US">https://bugs.openjdk.org/browse/JDK-8032359</span></a></span><span lang="EN-US" style="color:#1F2328"> but
this was closed as won't fix.</span><span lang="EN-US" style="color:#212121"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span lang="EN-US" style="color:#1F2328">Let me know what you think.</span><span lang="EN-US" style="color:#212121"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt;background:white;caret-color: rgb(33, 33, 33);font-variant-caps: normal;orphans: auto;text-align:start;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="color:#1F2328">Cheers,<br>
Christoph</span><span style="color:#212121"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
</div>
</body>
</html>