get vs getJSON vs ajax (v3)

Revision 3 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
get
// Returns a string, which is then converted to JSON
$.get("https://api.github.com/repos/adobe/brackets/contributors", function(contributorsInfo) {})
ready
getJSON
// Returns JSON
$.getJSON("https://api.github.com/repos/adobe/brackets/contributors", function(contributorsInfo) {})
ready
getJSON callback=?
// Inserts a script element on the page, with data wrapped, by the server, in a function
$.getJSON("https://api.github.com/repos/adobe/brackets/contributors?callback=?", function(contributorsInfo) {})
ready
ajax JSON
// For comparison, returns JSON
$.ajax({
  url: "https://api.github.com/repos/adobe/brackets/contributors",
  dataType: "json"
}).done(function(contributorsInfo) {})
ready
ajax JSONP
// For comparison (same as getJSON callback=?, inserts a script element)
$.ajax({
  url: "https://api.github.com/repos/adobe/brackets/contributors",
  dataType: "jsonp"
}).done(function(contributorsInfo) {})
ready

Revisions

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