return-vs-not

JavaScript performance comparison

Test case created

Info

Just a quick test for SO.

Preparation code

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


<a>Show Question</a>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
return-text
$('a').text(function(i, text) {
    return text == 'Show Question' ? 'Hide Question' : 'Show Question';
});
pending…
straight-text
$('a').text(!$(this).is(':visible') ? "Show Question" : "Hide Question");
pending…

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

Compare results of other browsers

0 comments

Add a comment