Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
hex to array buffer
convert hex to array buffer
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
regex match
403481.5 Ops/sec
parseInt 16
738427.1 Ops/sec
Script Preparation code:
var hexVal = 'ed0c356af33bb022afe7c5f8557ad89c'; function hexToArrayBuffer(hex) { return new Uint8Array(hex.match(/[\da-f]{2}/gi).map((h) => { return parseInt(h, 16); })).buffer; } function hexStringToUint8Array(hexString) { var arrayBuffer = new Uint8Array(hexString.length / 2); for (var i = 0; i < hexString.length; i += 2) { var byteValue = parseInt(hexString.substr(i, 2), 16); arrayBuffer[i / 2] = byteValue; } return arrayBuffer; }
Tests:
regex match
hexToArrayBuffer(hexVal)
parseInt 16
hexStringToUint8Array(hexVal)