<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [~Bug] The ArcGIS JS API ES modules are bigger than they should be ! in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036891#M72071</link>
    <description>&lt;P&gt;Thanks a lot Andy for the update.&lt;/P&gt;&lt;P&gt;I don't think there is any rush and it's great to know it will be handled.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Mar 2021 21:39:06 GMT</pubDate>
    <dc:creator>VictorBerchet</dc:creator>
    <dc:date>2021-03-15T21:39:06Z</dc:date>
    <item>
      <title>[~Bug] The ArcGIS JS API ES modules are bigger than they should be !</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036471#M72052</link>
      <description>&lt;P&gt;I was looking at my generated JS after I switched to the ES modules.&lt;/P&gt;&lt;P&gt;It was all nicely minified until I reached code like:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  `),e.fragment.uniforms.add("ovInnerColorTex","sampler2D"),e.fragment.uniforms.add("ovOuterColorTex","sampler2D"),e.fragment.uniforms.add("overlayOpacity","float"),e.fragment.code.add(PG`
    vec4 getOverlayColor(sampler2D ov0Tex, sampler2D ov1Tex, vec4 texCoords) {
      // read textures outside of conditions, to avoid artifacts likely related to non-uniform flow control:
      // - https://www.khronos.org/opengl/wiki/Sampler_(GLSL)#Non-uniform_flow_control
      // - https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/13657
      vec4 color0 = texture2D(ov0Tex, texCoords.xy);
      vec4 color1 = texture2D(ov1Tex, texCoords.zw);

      float valid0 = float((texCoords.x &amp;gt;= 0.0) &amp;amp;&amp;amp; (texCoords.x &amp;lt;= 1.0) &amp;amp;&amp;amp; (texCoords.y &amp;gt;= 0.0) &amp;amp;&amp;amp; (texCoords.y &amp;lt;= 1.0));
      float valid1 = float((texCoords.z &amp;gt;= 0.0) &amp;amp;&amp;amp; (texCoords.z &amp;lt;= 1.0) &amp;amp;&amp;amp; (texCoords.w &amp;gt;= 0.0) &amp;amp;&amp;amp; (texCoords.w &amp;lt;= 1.0));

      // Pick color0 if valid, otherwise color1 if valid, otherwise vec4(0)
      return mix(color1 * valid1, color0, valid0);
    }&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This code is from&amp;nbsp;@Anonymous User/core/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You can notice several things:&lt;/DIV&gt;&lt;DIV&gt;1) There are useless (in prod) comments,&lt;/DIV&gt;&lt;DIV&gt;2) Each code line start with 6 useless spaces,&lt;/DIV&gt;&lt;DIV&gt;3) Longer than needed variable names (color0, valid0 could be c, v).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1 and 2 should be easier to fix. Fixing 3 would need to be able to parse webGL and minify it - maybe there are existing plugins ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It is hard to evaluate the extra payload needed to be downloaded but I would evaluate it to a few percents looking at my JS output. I really think it would be worth looking into this savings.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I tried to manually minify the code above. It went from 786 to 259B - that's a 3x saving (of course not all code is webGL).&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any thought from the ESRI team ?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Vic&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 15 Mar 2021 04:49:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036471#M72052</guid>
      <dc:creator>VictorBerchet</dc:creator>
      <dc:date>2021-03-15T04:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: [~Bug] The ArcGIS JS API ES modules are bigger than they should be !</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036648#M72063</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/21011"&gt;@VictorBerchet&lt;/a&gt;&amp;nbsp;Thanks for reporting. It looks like the template literals aren't minified. We're taking a look.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 15:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036648#M72063</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2021-03-15T15:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: [~Bug] The ArcGIS JS API ES modules are bigger than they should be !</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036883#M72070</link>
      <description>&lt;P&gt;Quick follow-up, we've opened an issue to look into minifying the GLSL files. It won't happen immediately, but it's now something that's on our radar, thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 21:25:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036883#M72070</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2021-03-15T21:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: [~Bug] The ArcGIS JS API ES modules are bigger than they should be !</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036891#M72071</link>
      <description>&lt;P&gt;Thanks a lot Andy for the update.&lt;/P&gt;&lt;P&gt;I don't think there is any rush and it's great to know it will be handled.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 21:39:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-the-arcgis-js-api-es-modules-are-bigger-than/m-p/1036891#M72071</guid>
      <dc:creator>VictorBerchet</dc:creator>
      <dc:date>2021-03-15T21:39:06Z</dc:date>
    </item>
  </channel>
</rss>

