Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130
Windows
Desktop
5 months ago
Test name Executions per second
normal array 11036072.0 Ops/sec
frozen array 8346339.5 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'
    }