Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Chrome 96
Windows 7
Desktop
2 years ago
Test name Executions per second
find with tag selector 960244.1 Ops/sec
find with id 1669693.1 Ops/sec
HTML Preparation code:
AخA
 
1
<a id="parent" >
2
  <span id="child">Need span</span>
3
  <svg class="icon md-16 icon-shevron-right text-muted"></svg>
4
</a>
5
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js'></script>
Script Preparation code:
 
var $element = $("#parent");
Tests:
  • find with tag selector

     
    $element.find("span");
  • find with id

     
    $("#child");