Tests:
  • regex-short

    x
     
    const alpha = "Alpha";
    const upperAlpha = "ALPHA";
    const lowerAlpha = 'alpha';
    const regexAlpha = new RegExp(/alpha/i);
    var output;
    output = regexAlpha.test(alpha);
    output = regexAlpha.test(lowerAlpha);
    output = regexAlpha.test(upperAlpha);
  • upper-short

     
    const alpha = "Alpha";
    const upperAlpha = "ALPHA";
    const lowerAlpha = 'alpha';
    const regexAlpha = new RegExp(/alpha/i);
    var output;
    output = alpha.toUpperCase() === upperAlpha;
    output = alpha.toUpperCase() === upperAlpha;
    output = alpha.toUpperCase() === upperAlpha;
  • lower-short

     
    const alpha = "Alpha";
    const upperAlpha = "ALPHA";
    const lowerAlpha = 'alpha';
    const regexAlpha = new RegExp(/alpha/i);
    var output;
    output = alpha.toLowerCase() === lowerAlpha;
    output = alpha.toLowerCase() === lowerAlpha;
    output = alpha.toLowerCase() === lowerAlpha;
  • regex-long

     
    const longString = `The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.`;
    const lowerLongString = longString.toLowerCase();
    const upperLongString = longString.toUpperCase();
    const regexLong = new RegExp(/The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too./i);
    var output;
    output = regexLong.test(longString);
    output = regexLong.test(lowerLongString);
    output = regexLong.test(upperLongString);
  • lower-long

     
    const longString = `The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.`;
    const lowerLongString = longString.toLowerCase();
    const upperLongString = longString.toUpperCase();
    const regexLong = new RegExp(/The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too./i);
    var output;
    output = longString.toLowerCase() === lowerLongString;
    output = longString.toLowerCase() === lowerLongString;
    output = longString.toLowerCase() === lowerLongString;
  • upper-long

     
    const longString = `The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.`;
    const lowerLongString = longString.toLowerCase();
    const upperLongString = longString.toUpperCase();
    const regexLong = new RegExp(/The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too./i);
    var output;
    output = longString.toUpperCase() === upperLongString;
    output = longString.toUpperCase() === upperLongString;
    output = longString.toUpperCase() === upperLongString;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    regex-short
    upper-short
    lower-short
    regex-long
    lower-long
    upper-long

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111 on Windows
View result in a separate tab
Test name Executions per second
regex-short 3954213.0 Ops/sec
upper-short 5058179.0 Ops/sec
lower-short 5161324.5 Ops/sec
regex-long 762779.4 Ops/sec
lower-long 1533983.5 Ops/sec
upper-long 1508668.4 Ops/sec