JQuery Empty vs blank Text

Benchmark created on


Preparation HTML

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
 
<div id="theOne">some text here</div>

Test runner

Ready to run.

Testing in
TestOps/sec
Empty 100K
var theOne = $("#theOne");

for (var i=0; i<100000; i++)
{
	theOne.empty();
}
ready
Text Clear 100K
var theOne = $("#theOne");

for (var i=0; i<100000; i++)
{
	theOne.text("");
}
ready

Revisions

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