title: Does a Firefox Add-on significantly outperform a Greasemonkey script?
body: <p>I have written a Greasemonkey script that is running on all sites checking some things.<br>
  Because it runs on every page, performance is important. Thus I wonder, if an Firefox add-on could be faster. </p>
  
  <p>So these are my questions:  </p>
  
  <ul>
  <li>Does Greasemonkey need to reload the script on every page (re-)load?</li>
  <li>Could an add-on increase the performance?</li>
  <li>What are the advantages, disadvantages?</li>
  </ul>
  
  <p>UPDATE:<br>
  Some background info - I'm doing a page load latency evaluation on my script.</p>
  
  <p>UPDATE 2 (more information):<br>
  The head of my script looks like this:  </p>
  
  <pre><code>// ==UserScript==
  // @name        My Script
  // @namespace   abc
  // @description What it does
  // @include     *
  // @resource    moz_list  http://mxr.mozilla.org/mozilla/source/netwerk/dns/src/effective_tld_names.dat?raw=1
  // @resource    resource_B http://mysite.org/res
  // @version     1.0
  // @grant       GM_xmlhttpRequest
  // @grant       GM_getValue
  // @grant       GM_setValue
  // @grant       GM_getResourceText  
  // ==/UserScript==  
  </code></pre>
  
  <p>Additionally I use these technologies:  </p>
  
  <ul>
  <li>Dictionary and array data types</li>
  <li>RegExp for matching links</li>
  <li>tldextract code from here: <a href="https://github.com/masylum/tldextract" rel="nofollow">https://github.com/masylum/tldextract</a></li>
  <li>JSON for storing and retrieving the dictionary in the cache (could stringify and eval be faster?)</li>
  <li>document.getElementsByTagName()</li>
  <li>window.location.hostname</li>
  </ul>
  
  <p>In pseudocode my main functionality is like this:  </p>
  
  <pre><code>var host = window.location.hostname;
  host = host.replace('www.', '');
  if (host in my_dictionary) {
      var links = document.getElementsByTagName('a');
      for (i = 0; i &lt; links.length; i++) {
          if (host != links[i].hostname) {
              if (links[i].href in my_dictionary[host]) {
                  do_some_stuff();
              }
          }
      }
  } else {
      send_to_my_server(host);
  }
  </code></pre>