HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
  • Lodash

     
    function getRandomString(length) {
      const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
      let result = "";
      for (let i = 0; i < length; i++) {
        const randomIndex = Math.floor(Math.random() * charset.length);
        result += charset.charAt(randomIndex);
      }
      return result;
    }
    function getRandomBoolean() {
      return Math.random() < 0.5; // Generates true or false with roughly equal probability
    }
    function generateArrayOfJSONObjects(length) {
      const jsonArray = [];
      for (let i = 0; i < length; i++) {
        const jsonObject = {
          name: getRandomString(10), // Change 10 to the desired length of the random string
          value: getRandomBoolean(),
        };
        jsonArray.push(jsonObject);
      }
      return jsonArray;
    }
    const array = generateArrayOfJSONObjects(10);
    const found = _.some(array, s => s.value);
  • JS some

     
    function getRandomString(length) {
      const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
      let result = "";
      for (let i = 0; i < length; i++) {
        const randomIndex = Math.floor(Math.random() * charset.length);
        result += charset.charAt(randomIndex);
      }
      return result;
    }
    function getRandomBoolean() {
      return Math.random() < 0.5; // Generates true or false with roughly equal probability
    }
    function generateArrayOfJSONObjects(length) {
      const jsonArray = [];
      for (let i = 0; i < length; i++) {
        const jsonObject = {
          name: getRandomString(10), // Change 10 to the desired length of the random string
          value: getRandomBoolean(),
        };
        jsonArray.push(jsonObject);
      }
      return jsonArray;
    }
    const array = generateArrayOfJSONObjects(10);
    const found = array.some(s => s === 'oranges');
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash
    JS some

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/117.0
Firefox 117 on Windows
View result in a separate tab
Test name Executions per second
Lodash 950575.4 Ops/sec
JS some 926079.6 Ops/sec