HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
x
 
function generateRandomStrings(count = 1000, length = 32) {
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  const charLen = chars.length;
  return Array.from({ length: count }, () => {
    let s = '';
    for (let i = 0; i < length; i++) {
      s += chars.charAt(Math.floor(Math.random() * charLen));
    }
    return s;
  });
}
function arraysEqualBySorting(a, b) {
  if (a.length !== b.length) return false;
  return _.isEqual(_.sortBy(a), _.sortBy(b));
}
var first = generateRandomStrings();
var second = generateRandomStrings();
Tests:
  • With 10000

     
    arraysEqualBySorting(generateRandomStrings(10000, 32), generateRandomStrings(10000, 32))
  • With 100000

     
    arraysEqualBySorting(generateRandomStrings(100000, 32), generateRandomStrings(100000, 32))
  • With 100000 and same arrays

     
    var a = generateRandomStrings(100000, 32)
    arraysEqualBySorting(a, a)
  • With 100000 and 128 strings

     
    arraysEqualBySorting(generateRandomStrings(100000, 128), generateRandomStrings(100000, 128))
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    With 10000
    With 100000
    With 100000 and same arrays
    With 100000 and 128 strings

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 22 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
With 10000 26.9 Ops/sec
With 100000 2.3 Ops/sec
With 100000 and same arrays 3.6 Ops/sec
With 100000 and 128 strings 0.5 Ops/sec