Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130
Mac OS X 10.15.7
Desktop
5 months ago
Test name Executions per second
normal array 22742072.0 Ops/sec
frozen array 19332124.0 Ops/sec
Script Preparation code:
AخA
 
var a = [
    /@atlassian\/parcel/,
    /@parcel\//,
    /@oxc-resolver\/.+/,
];
var b = Object.freeze([
    /@atlassian\/parcel/,
    /@parcel\//,
    /@oxc-resolver\/.+/,
]);
Tests:
  • normal array

     
    for (const matcher of a) {
        if (matcher.test("SOMETHING")) { return 'yes'; }
        return 'no'
    }
  • frozen array

     
    for (const matcher of b) {
        if (matcher.test("SOMETHING")) { return 'yes'; }
        return 'no'
    }