Script Preparation code:
x
 
var saltVal = crypto.getRandomValues(new Uint8Array(16));
function arrayBufferToHexString(bytes) {
    bytes = new Uint8Array(bytes);
    var hex = [];
    for (let i = 0; i < bytes.length; i++) {
        hex[i] = ("0" + bytes[i].toString(16)).slice(-2);
    }
    return hex.join("");
}
function bytesToHexString(bytes) {
    bytes = new Uint8Array(bytes);
    var hexBytes = [];
    for (var i = 0; i < bytes.length; i++) {
        hexBytes.push(("0" + bytes[i].toString(16)).slice(-2));
    }
    return hexBytes.join("");
}
Tests:
  • directly set

     
    arrayBufferToHexString(saltVal);
  • push values

     
    bytesToHexString(saltVal)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    directly set
    push values

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
directly set 1738722.5 Ops/sec
push values 1542617.1 Ops/sec