title: What's the fastest way to generate 10M UUID4s in Python
body: <p>I need to generate a large number of UUIDs (v4).</p>
  <p>For a baseline, the following code takes about ~60 seconds</p>
  <pre><code>import uuid
  a = [uuid.uuid4() for x in range(10000000)]
  
  </code></pre>
  <p>I've tried a few different things (a few different UUID libraries but all of them seem to be unmaintained or not compatible with python 3.9)</p>
  <p>I've also tried using some kind of multithreaded code but if anything I always end up with slower performance than the baseline.</p>
  <p>This seems like something that should be able to be done faster than a minute - but maybe I'm just not understanding some underlying concept of how UUID's are generated?</p>