DEV Community

Discussion on: crypto.randomUUID is three times faster uuid.v4

Collapse
 
rangoo94 profile image
Dawid Rusnak • Edited

Actually, the randomUUID in Node v15.12+/v16 is a little more optimized, and outperforms it even more :)

Benchmark #3: node-15 native.js
  Time (mean ± σ):     564.6 ms ±   5.5 ms    [User: 556.8 ms, System: 14.1 ms]
  Range (min … max):   559.6 ms … 575.2 ms    10 runs

Summary
  'node-15 native.js' ran
    1.01 ± 0.01 times faster than 'node-16 native.js'
    3.51 ± 0.09 times faster than 'node-14 native.js'
   11.18 ± 0.13 times faster than 'node-14 uuid.js'
   12.52 ± 0.14 times faster than 'node-16 uuid.js'
   12.65 ± 0.26 times faster than 'node-15 uuid.js'
Enter fullscreen mode Exit fullscreen mode
Collapse
 
galkin profile image
Nikita Galkin

Thank you!

Collapse
 
qm3ster profile image
Mihail Malo

It seems the faster crypto.randomUUID is, the slower uuid.js runs on that version :D