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/140.0.0.0 Safari/537.36 Edg/140.0.0.0
Browser:
Chrome 140
Operating system:
Windows
Device Platform:
Desktop
Date tested:
11 months ago
parseInt 16
1.2M/s
regex match
388K/s
View exact numbers
Test name
Executions per second
✓
parseInt 16
1,206,874 Ops/sec
regex match
388,085 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)