<p dir="auto">I know ES Module support is WIP, just having a few questions when quickly going through the code (I'll later do more experiments myself):</p>
<p dir="auto">With <code class="notranslate">isolate::execute_mod</code>, seems that it is fetching source code every single time even with the same source file<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/denoland/deno/blob/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22/src/isolate.rs#L239-L240">deno/src/isolate.rs</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 239 to 240
      in
      <a data-pjax="true" class="commit-tease-sha" href="/denoland/deno/commit/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22">4f62a56</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L239" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="239"></td>
          <td id="LC239" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">let</span> js_source = <span class="pl-smi">CString</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span>out<span class="pl-kos">.</span><span class="pl-en">js_source</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">clone</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">unwrap</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L240" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="240"></td>
          <td id="LC240" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">let</span> js_source_ptr = js_source<span class="pl-kos">.</span><span class="pl-en">as_ptr</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-k">as</span> <span class="pl-c1">*</span><span class="pl-k">const</span> <span class="pl-smi">i8</span><span class="pl-kos">;</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
and repeatedly compile<br>
<div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/denoland/deno/blob/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22/libdeno/binding.cc#L464">deno/libdeno/binding.cc</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 464
      in
      <a data-pjax="true" class="commit-tease-sha" href="/denoland/deno/commit/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22">4f62a56</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L464" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="464"></td>
          <td id="LC464" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">auto</span> maybe_module = <span class="pl-c1">CompileModule</span>(context, js_filename, source); </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
and repeatedly register<br>
<div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/denoland/deno/blob/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22/libdeno/binding.cc#L395">deno/libdeno/binding.cc</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 395
      in
      <a data-pjax="true" class="commit-tease-sha" href="/denoland/deno/commit/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22">4f62a56</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L395" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="395"></td>
          <td id="LC395" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> d-&gt;<span class="pl-c1">RegisterModule</span>(js_filename, module); </td>
        </tr>
    </tbody></table>
  </div>
</div>
<br>
Given the assumption that IdentityHash is unique, I'm not quite sure if this is considered unnecessary overhead if a previously compiled module is already available? (or possibly such action is deliberate?)<p></p>
<p dir="auto">(As to IdentityHash, it seems Node is using a <a href="https://github.com/nodejs/node/blob/ca9c0c90c28ed012cdd5be4e94a974ad07fd9b9a/src/env.h#L700">multimap</a> when working with it, so I would assume it still has quite a chance of collision... Probably we could use a similar design (that keeps a reference of the module along with the filename as map value) to circumvent the problem)</p>
<p dir="auto">Also, similar things happens with <code class="notranslate">ResolveOk</code>, with which we pass in the source code every time but might not be even used:<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/denoland/deno/blob/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22/libdeno/binding.cc#L431-L437">deno/libdeno/binding.cc</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 431 to 437
      in
      <a data-pjax="true" class="commit-tease-sha" href="/denoland/deno/commit/4f62a56f9071b0541b6be9b8e9c40fdcc2a3da22">4f62a56</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L431" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="431"></td>
          <td id="LC431" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">void</span> <span class="pl-en">DenoIsolate::ResolveOk</span>(<span class="pl-k">const</span> <span class="pl-k">char</span>* filename, <span class="pl-k">const</span> <span class="pl-k">char</span>* source) { </td>
        </tr>

        <tr class="border-0">
          <td id="L432" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="432"></td>
          <td id="LC432" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">   <span class="pl-c1">CHECK</span>(resolve_module_.<span class="pl-c1">IsEmpty</span>()); </td>
        </tr>

        <tr class="border-0">
          <td id="L433" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="433"></td>
          <td id="LC433" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">   <span class="pl-k">auto</span> count = module_map_.<span class="pl-c1">count</span>(filename); </td>
        </tr>

        <tr class="border-0">
          <td id="L434" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="434"></td>
          <td id="LC434" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">   <span class="pl-k">if</span> (count == <span class="pl-c1">1</span>) { </td>
        </tr>

        <tr class="border-0">
          <td id="L435" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="435"></td>
          <td id="LC435" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">auto</span> module = module_map_[filename].<span class="pl-c1">Get</span>(isolate_); </td>
        </tr>

        <tr class="border-0">
          <td id="L436" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="436"></td>
          <td id="LC436" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     resolve_module_.<span class="pl-c1">Reset</span>(isolate_, module); </td>
        </tr>

        <tr class="border-0">
          <td id="L437" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="437"></td>
          <td id="LC437" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">   } <span class="pl-k">else</span> { </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Enter <code class="notranslate">import ""</code> into your editor. Place the cursor after the first <code class="notranslate">"</code>. Now enter <code class="notranslate">../</code>. The import now probably contains <code class="notranslate">../deps.ts/</code> or a reference to some other JS file in the parent directory of the file you were trying.</p>
<p dir="auto">(I'd add a screen capture, but I can't get my screen recording to work anymore).</p>
<p dir="auto">This effectively means you can not manually type out specifiers unless you press <code class="notranslate">Esc</code> between every key stroke. Highly frustrating.</p>