title: Why fs.readfile benchmark times are very different from crypto.pbkdf2?
body: <p>I'm trying to understand how Nodejs uses libuv threadpool. Turns out there are some modules that uses this threadpool like fs and crypto so I tried this :</p>
  <pre><code>const crypto = require(&quot;crypto&quot;)
  const start = Date.now()
  
  for (let i = 0; i &lt; 5; i++) {
      crypto.pbkdf2('a', 'b', 100000, 512, 'sha512', () =&gt; {
          console.log(`${i + 1}: ${Date.now() - start}`)
      })
  }
  </code></pre>
  <p>the results were :</p>
  <pre><code>1: 1178
  2: 1249
  3: 1337
  4: 1344
  5: 2278
  </code></pre>
  <p>And that was expected. The default threadpool size is 4, so 4 hashes will finish almost at the same time and the fifth will wait.
  But when I do the same thing with fs.readfile() :</p>
  <pre><code>const start = Date.now()
  const fs = require('fs')
  for (let i = 0; i &lt; 5; i++) {
      fs.readFile('./test.txt', () =&gt; {
          console.log(`${i + 1} : ${Date.now() - start}`)
      })
  }
  </code></pre>
  <p>I get this:</p>
  <pre><code>1 : 7
  2 : 20
  3 : 20
  4 : 20
  5 : 21
  </code></pre>
  <p>There is always one that finishes first and the others finish around the same time. I tried reading the file just twice, the same thing happens one will finish first the second after. I also tried reading it 10 times, same thing. Why is this happening</p>
  <p>Edit:</p>
  <ul>
  <li>test.txt is just 5 bytes</li>
  <li>I'm using a quad-core laptop running windows 10</li>
  </ul>