GPT

JavaScript performance comparison

Test case created by Taylor Buley

Info

Testing whether the GPT ad loader could be improved.

The ad giant asks for it to be placed in the head of a document, so performance is imperative.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Google
// async test
(function() {
  var gads = document.createElement('script');
  gads.async = true;
  gads.type = 'text/javascript';
  var useSSL = 'https:' == document.location.protocol;
  gads.src = (useSSL ? 'https:' : 'http:') + '//www.googletagservices.com/tag/js/gpt.js';
  var node = document.getElementsByTagName('script')[0];
  node.parentNode.insertBefore(gads, node);
  deferred.resolve();
})();
pending…
Buley
// async test
(function() {
  var head = document.getElementsByTagName("head")[0] || document.documentElement,
      gads = head.getElementsByTagName('script')[0].cloneNode(false);
  gads.async = true;
  gads.src = '//www.googletagservices.com/tag/js/gpt.js';
  head.insertBefore(gads, head.firstChild);
  deferred.resolve();
})();

// jQuery/Google loader hybrid with size and speed improvements thanks to
// cloning an existing script, which comes with type attributes
// and object initialization built in. Based on Google's
// clever assumption that if you're executing JavaScript,
// a script tag exists somewhere, but using jQuery's
// approach to inserting to the head or document's first child
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment