title: How to perform fast search on JSON file?
body: <p>I have a json file that contains many objects and options.</p>
  
  <p>Each of these kinds:</p>
  
  <pre><code>{"item": "name", "itemId": 78, "data": "Some data", ..., "option": number or string}
  </code></pre>
  
  <p>There are about 10,000 objects in the file.</p>
  
  <p>And when part of item value("ame", "nam", "na", etc) entered , it should display all the objects and their options that match this part.</p>
  
  <p>RegExp is the only thing that comes to my mind, but at 200mb+ file it starts searching for a long time(2 seconds+)</p>
  
  <p>That's how I'm getting the object right now:</p>
  
  <pre><code>let reg = new RegExp(enteredName, 'gi'), //enteredName for example "nam"
      data = await fetch("myFile.json"),
      jsonData = await data.json();
  
  let results = jsonData.filter(jsonObj =&gt; {
      let item = jsonObj.item,
          itemId = String(jsonObj.itemId);
      return reg.test(item) || reg.test(itemId);
  });
  </code></pre>
  
  <p>But that option is too slow for me.</p>
  
  <p>What method is faster to perform such search using js?</p>