Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
UUID Implementations vs crypto
(version: 1)
Comparing performance of:
crypto vs regex v1 vs regex v2
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
crypto
const uuid = crypto.randomUUID();
regex v1
let d = Date.now(); if ( typeof performance !== 'undefined' && typeof performance.now === 'function' ) { d += performance.now(); // use high-precision timer if available } const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { const r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16); });
regex v2
const uuid = () => [...Array(4)].map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join('-');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
crypto
regex v1
regex v2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
crypto
749262.1 Ops/sec
regex v1
398273.9 Ops/sec
regex v2
132392696.0 Ops/sec
Related benchmarks:
create_UUID
create_UUID.
UUID V4 Crypto vs Math
UUID Generator
UUID methods
UUID Implentations Comparison
perforamanceUuid
UUID m21ethods
UUID Implentations vs crypto
Comments
Confirm delete:
Do you really want to delete benchmark?