Condition order (v2)

Revision 2 of this benchmark created on


Setup

const a = 'data:image/;+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C!--%20Generator%3A%20Adobe%20Illustrator%2027.6.1%2C%20SVG%20Export%20Plug-In%20.%20SVG%20Version%3A%206.00%20Build%200)%20%20--%3E%3Csvg%20version%3D%221.1%22%20id%3D%22Layer_1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20845.97%20106.19%22%20style%3D%22enable-background%3Anew%200%200%20845.97%20106.19%3B%22%20xml%3Aspace%3D%22preserve%22%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E.st0%7Bfill%3A%23FFFFFF%3B%7D%3C%2Fstyle%3E%3Cpath%20class%3D%22st0%22%20d%3D%22M134.76%2C64.15c0.86%2C1.01%2C1.87%2C1.94%2C3.1%2C2.74c2.02%2C1.37%2C4.97%2C2.67%2C8.79%2C2.67c5.76%2C0%2C8.28-2.52%2C8.28-5.76c0-8.57-25.2-4.75-25.2-22.32c0-7.92%2C6.84-14.76%2C18.36-14.76c5.54%2C0%2C9.86%2C1.73%2C12.67%2C3.46c1.66%2C1.01%2C3.02%2C2.16%2C4.25%2C3.38l-7.2%2C7.2c-0.79-0.79-1.58-1.51-2.52-2.16c-1.66-1.08-3.96-2.16-6.84-2.16c-5.47%2C0-7.56%2C2.16-7.56%2C5.04c0%2C8.57%2C25.2%2C4.75%2C25.2%2C22.32c0%2C8.28-7.2%2C15.48-19.08%2C15.48c-6.55%2C0-11.38-1.94-14.62-3.96c-1.94-1.15-3.53-2.45-4.82-3.96L134.76%2C64.15z%20M181.92%2C27.79h9.72l17.28%2C21.6l17.28-21.6h9.72v50.4h-10.8V45.07l-16.2%2C20.16l-16.2-20.16v33.12h-10.8V27.79z%20M269.4%2C27.79h12.24l19.44%2C50.4h-11.52l-4.32-11.52H265.8l-4.32%2C11.52h-11.52L269.4%2C27.79z%20M281.64%2C56.95l-5.98-16.56h-0.29l-5.98%2C16.56H281.64z%20M315.12%2C27.79h22.32c10.8%2C0%2C17.64%2C6.84%2C17.64%2C16.92c0%2C5.76-2.09%2C9.5-4.32%2C11.74c-1.22%2C1.3-2.66%2C2.3-4.32%2C3.02l10.44%2C18.72H345l-9-16.56h-10.08v16.56h-10.8V27.79z%20M337.08%2C51.55c4.03%2C0%2C6.84-2.81%2C6.84-6.84s-2.81-6.84-6.84-6.84h-11.16v13.68H337.08z%20M381%2C37.87h-14.4V27.79h39.6v10.08h-14.4v40.32H381V37.87z%20M418.66%2C75.67h5.69V30.45h-5.69v-2.52h23.26c8.57%2C0%2C13.54%2C4.75%2C13.54%2C13.25c0%2C7.27-4.1%2C12.24-11.81%2C13.03l8.86%2C16.56c1.73%2C3.31%2C4.18%2C4.9%2C7.49%2C4.9h1.08v2.52h-3.53c-4.82%2C0-7.06-2.09-9.14-6.05l-9.29-17.35h-10.37v20.88h5.69v2.52h-15.77V75.67z%20M428.74%2C52.13h12.82c5.98%2C0%2C9.22-4.25%2C9.22-9.22v-3.1c0-4.97-3.24-9.22-9.22-9.22h-12.82V52.13z%20M470.35%2C75.67h5.69V30.45h-5.69v-2.52h35.64v11.52h-3.74V30.6h-21.82v20.16h16.06v-5.9h3.24v14.47h-3.24v-5.9h-16.06v22.11h22.47v-9.29h3.74v11.95h-36.29V75.67z%20M518.37%2C75.67h5.69V30.45h-5.69v-2.52h23.26c8.71%2C0%2C13.54%2C4.82%2C13.54%2C13.32c0%2C8.5-4.97%2C13.54-13.61%2C13.54h-13.1v20.88h7.13v2.52h-17.21V75.67z%20M528.45%2C52.13h12.89c5.9%2C0%2C9.14-4.25%2C9.14-9.22v-3.1c0-4.97-3.24-9.22-9.14-9.22h-12.89V52.13z%20M564.89%2C53.06c0-16.56%2C8.35-25.99%2C21.67-25.99c13.32%2C0%2C21.67%2C9.43%2C21.67%2C25.99s-8.35%2C25.99-21.67%2C25.99C573.24%2C79.06%2C564.89%2C69.62%2C564.89%2C53.06z%20M603.34%2C56.16v-6.19c0-12.38-6.12-20.09-16.78-20.09c-10.66%2C0-16.78%2C7.71-16.78%2C20.09v6.19c0%2C12.38%2C6.12%2C20.09%2C16.78%2C20.09C597.22%2C76.25%2C603.34%2C68.54%2C603.34%2C56.16z%20M618.09%2C75.67h5.69V30.45h-5.69v-2.52h23.26c8.57%2C0%2C13.54%2C4.75%2C13.54%2C13.25c0%2C7.27-4.1%2C12.24-11.81%2C13.03l8.86%2C16.56c1.73%2C3.31%2C4.18%2C4.9%2C7.49%2C4.9h1.08v2.52h-3.53c-4.82%2C0-7.06-2.09-9.14-6.05l-9.29-17.35h-10.37v20.88h5.69v2.52h-15.77V75.67z%20M628.17%2C52.13h12.82c5.98%2C0%2C9.22-4.25%2C9.22-9.22v-3.1c0-4.97-3.24-9.22-9.22-9.22h-12.82V52.13z%20M676.92%2C75.67h7.13V30.6H669.5v8.86h-3.74V27.93h40.97v11.52h-3.75V30.6h-14.54v45.08h7.13v2.52h-18.65V75.67z%20M716.95%2C75.67h5.69V30.45h-5.69v-2.52h15.77v2.52h-5.69v45.22h5.69v2.52h-15.77V75.67z%20M742.51%2C75.67h5.69V30.45h-5.69v-2.52h10.73l28.3%2C43.35h0.29V30.45h-5.69v-2.52h14.4v2.52h-5.69v47.74h-3.82l-29.52-45.36h-0.29v42.84h5.69v2.52h-14.4V75.67z%20M800.54%2C53.06c0-17.21%2C8.28-25.99%2C21.6-25.99c8.28%2C0%2C12.82%2C2.95%2C13.97%2C6.05h0.36v-5.18h3.74v14.69h-3.74v-4.03c0-5.47-5.83-8.71-13.83-8.71c-11.38%2C0-17.21%2C7.34-17.21%2C19.73v6.77c0%2C12.31%2C6.41%2C19.59%2C16.49%2C19.59c7.99%2C0%2C14.47-4.25%2C14.47-12.24v-6.77h-9.72v-2.52h19.3v2.52h-5.18v21.24h-1.94l-2.23-7.63h-0.29c-1.87%2C4.61-6.62%2C8.5-14.83%2C8.5C808.53%2C79.06%2C800.54%2C69.69%2C800.54%2C53.06z%20M79.42%2C84.86H58.54v21.33h20.88V84.86z%20M79.42%2C56.72H58.54V77.6h20.88V56.72z%20M79.42%2C28.13H58.54v21.33h20.88V28.13z%20M79.42%2C0H58.54v21.33h20.88V0z%20M109.82%2C56.72H88.49V77.6h21.33V56.72z%20M109.82%2C28.13H88.49v21.33h21.33V28.13z%20M49.47%2C28.13H28.14v21.33h21.33V28.13z%20M49.47%2C56.72H28.14V77.6h21.33V56.72z%20M21.33%2C42.2H0v21.33h21.33V42.2z%22%2F%3E%3C%2Fsvg%3E';

const b = 'http://www.someurl.com/image.png';

Test runner

Ready to run.

Testing in
TestOps/sec
startsWith || test
a.startsWith('data:') || /^https?\:/.test(a);
b.startsWith('data:') || /^https?\:/.test(b);

ready
test || startsWith
/^https?\:/.test(a) || a.startsWith('data:');
/^https?\:/.test(b) || b.startsWith('data:');
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.