jquery find class & str regex find

Benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<div id="container">
<span class="_f_aaa _f_bbb _f_ccc _f_ddd">
<span class="_f_eee">
<span class="_f_fff">
</span>
</span>
</span>
</div>

Test runner

Ready to run.

Testing in
TestOps/sec
jquery find class
$("._f_aaa,_f_bbb,_f_ccc,_f_ddd,_f_eee,_f_fff").size();
ready
jquery find attr
$("[class=^_f_]").size();
ready
str find _f_
$("#container").html().match(/_f_[0-9a-z]+/g).length;
ready

Revisions

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

  • Revision 1: published on
  • Revision 2: published by Kyle A. Matheny on
  • Revision 3: published by Kyle A. Matheny on
  • Revision 4: published by Kyle A. Matheny on