title: Execution times for decryption aren't uniform, half are around 0ms other half around 12ms, what's the reason? (NodeJS)
body: <p>So what Im doing is --</p>
  <p>I am calling a command like <code>node filepath.js encryptedInput</code> from a python script, 1000 times using <code>subprocess.run</code>. The node script is using the <code>crypto</code> library. NodeJS code is like this:</p>
  <pre><code>Start timer using process.hrtime
  read encryptedInput from command line argument
  use crypto to decrypt using encryption algorithm/cipher
  console log decrypted (convert hex to utf8)
  console log time taken
  </code></pre>
  <p>and I get the decrypted output like</p>
  <pre><code>This is the decrypted text
  12.23ms
  </code></pre>
  <p>so all of this works great. Python then takes the <code>12.23</code> from the output and stores in array, and the time output is produced and stored in an array with 1000 entries and plotted.</p>
  <p>NOW, my issue is.....I have the exact same code in two NodeJS scripts, except the encryption algorithm is different (but using the same libraries and records time the same way)</p>
  <p>The script using the AES cipher returns time consistent around 11-12ms 1000 times</p>
  <p>But, the script using ChaCha20 cipher returns half of the 1000 trial time data at around 0.002 or something ms (near zero) and other half around 11ms....but for this script if I don't convert the hex output to utf8 then the time gets consistent around 12ms or so, although the AES script is using the same library for decryption and returns utf8 and the times are consistent</p>
  <p>My question is....why is the ChaCha20 script returning weird data, although it uses the same library and same code (Except one line, where in the algorithm name section it is chacha20 instead of aes and it uses the appropiate key size) and why is the AES one consistent?</p>
  <p>Encryption decryption works properly because the plaintext retrieved is accurate</p>
  <p>Any idea what to do? I am testing the time taken to get readable text data from the script, so I guess converting to utf8 readable text is part of the process. Thanks for reading this far :)</p>